如何使用 tikz 创建 Leontief-Gozintograph?

如何使用 tikz 创建 Leontief-Gozintograph?

我正在寻找一种方法来创建一个与此类似的 leontief-gozintograph:

在此处输入图片描述

我搜索了http://www.texample.net/tikz/examples/没有成功。有没有人已经创建过类似的东西?

答案1

这是一个 tikz 解决方案。

在此处输入图片描述

代码

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\begin{document}
\tikzset{
  adim/.style={rectangle,minimum width=50,minimum height= 20,draw,thick},
  nn/.style={rectangle,minimum width=210, minimum height=20,draw,thick},
}

\begin{tikzpicture}
  \node (UR) [adim] at (5,4)  {B60};
  \node (UL) [adim] at (-1,4) {A80};
  \node (C)  [adim] at (2,2)  {C100};
  \node (B)  [nn]   at (2,0)  {Konsum};
\draw[thick,->] (UL.north)  to[out=90, in=180, looseness=6]node[above]{a} (UL.west);
\draw[thick,->] (UR.north) to[out=90, in=0, looseness=6] node[above]{36} (UR.east);
\draw[thick,->] ($(UR.west)+(0,0.2)$) -- ($(UL.east)+(0,0.2)$) node[midway,above]{18};
\draw[thick,->] ($(UL.east)+(0,-0.2)$) -- ($(UR.west)+(0,-0.2)$) node[midway,below]{4};
\draw[thick,->] (UR) -- ($(B.north)+(3,0)$) node[midway,right]{15};
\draw[thick,->] (UL) -- ($(B.north)+(-3,0)$) node[midway,left]{14};
\draw[thick,->] (C) -- ($(B.north)+(0,0)$) node[midway,left]{48};
\draw[thick,<-] (UR.south west) -- (C.north east) node[midway,above]{6};
\draw[thick,->] (UR.south) -- (C.south east) node[midway,below]{b};
\draw[thick,<-] (UL.south east) -- (C.north west) node[midway,above]{c};
\draw[thick,->] (UL.south) -- (C.south west) node[midway,left]{40};
\draw[thick,->] ($(C.north east)+(-0.2,0)$) to[out=100,in=80] node[above]{30} ($(C.north west)+(0.2,0)$);
\end{tikzpicture} 
\end{document}

答案2

PSTricks 解决方案:

\documentclass{article}

\usepackage{pstricks-add}

\def\DoubleArrow[#1]#2#3#4#5{%
 {\psset{offset = #1, arrows = ->}
  \ncline{#2}{#3}
  \ncline{#3}{#2}}
 {\psset{offset = 8pt, linestyle = none}
  \pcline(#2)(#3)
  \ncput{\small #4}
  \pcline(#3)(#2)
  \ncput{\small #5}}%
}
\def\SingleArrow(#1,#2)(#3,#4)#5{%
  \pcline{->}(#1,#2)(#3,#4)
 {\psset{offset = -8pt, linestyle = none}
  \pcline(#1,#2)(#3,#4)
  \ncput{\small #5}}%
}

\begin{document}

\psset{unit = 0.5}
\begin{pspicture}(19.3,12)
  \psTextFrame(1,0)(18,1){Konsum}
  \psTextFrame(1,10)(3,11){A~80}
  \psarc{->}(1,11){0.8}{0}{270}
  \rput(0.1,11.9){a}
  \psTextFrame(8.3,5.5)(10.7,6.5){C~100}
  \psarc{->}(9.5,6.05){0.8}{30}{150}
  \rput(9.5,7.3){\small 30}
  \psTextFrame(16,10)(18,11){B~60}
  \psarc{<-}(18,11){0.8}{-90}{180}
  \rput(19.1,11.8){\small 36}
  \pnodes{P}(0,0)(3,10)(8.3,6.5)(10.7,6.5)(16,10)(3,10.5)(16,10.5)
  \DoubleArrow[-2pt]{P1}{P2}{40}{c}
  \DoubleArrow[2pt]{P3}{P4}{6}{b}
  \DoubleArrow[2pt]{P5}{P6}{18}{4}
  \SingleArrow(2,10)(2,1){14}
  \SingleArrow(17,10)(17,1){15}
  \SingleArrow(9.5,5.5)(9.5,1){48}
\end{pspicture}

\end{document}

输出

答案3

这是另一个基于 Jesse 的代码的 tikz 解决方案:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,automata,positioning,calc}
\begin{document}
\begin{center}
\tikzset{adim/.style={rectangle,minimum width=50,minimum height= 20,draw,thick}, nn/.style={rectangle,minimum width=210, minimum height=20,draw,thick},}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=7cm, thick,main node/.style={draw,font=\sffamily\Large\bfseries}]
 \node (B) [adim] at (5,4)  {B 60};
 \node (A) [adim] at (-1,4) {A 80};
 \node (C)  [adim] at (2,2)  {C 100};
 \node (K)  [nn]   at (2,0)  {Konsum}; 
 \path[every node/.style={font=\sffamily\small}]
      ($(C.north west)+(0,-0.2)$) edge [bend right=8] node[right] {c} (A)
      ($(C.north east)+(0,-0.2)$) edge [bend left=8] node[midway,above,left] {6}(B)
      (C)   edge node {150}(K)
      ($(C.north east)+(-0.2,0)$) edge [out=100,in=80] node[above]{30} ($(C.north west)+(0.2,0)$)
      (A) edge [bend right=8] node[midway,below,left]  {40} ($(C.south west)+(0,0.275)$)
          edge [bend left=8] node[midway,above] {104}(B)
          edge node[midway,left]{14} ($(K.north)+(-3,0)$)
      ($(A.north east)+(-0.2,0)$) edge [out=100,in=80] node[above]{a} ($(A.north west)+(0.2,0)$)
      (B) edge [bend left=8] node[midway,below,right]  {105} ($(C.south east)+(0,0.275)$)
          edge [bend left=8] node[midway,below] {106}(A)
          edge node[midway,right]{15} ($(K.north)+(3,0)$)
      ($(B.north east)+(-0.2,0)$) edge [out=100,in=80] node[above]{30} ($(B.north west)+(0.2,0)$);
 \end{tikzpicture}
 \end{center}
 \end{document}

戈津托仪

相关内容