我制作了这张图表,直观地展示了各种反应扩展 Xi 在反应器 R101 和 R102 上的相互关系,从而决定了循环比 R、清洗和补充流量。在花了几个小时研究我的初稿后,我仍然对结果不太满意:
这是我的代码。如果能提出改进建议,我们将不胜感激。
\begin{figure}[!ht]
\centering
\scalebox{1.2}[1.2]{
\begin{tikzpicture}[node distance=2cm,>=stealth',bend angle=45,auto]
\tikzstyle{place}=[circle,thick,draw=blue!75,fill=blue!20,minimum size=6mm]
\tikzstyle{red place}=[place,draw=red!75,fill=red!20]
\tikzstyle{transition}=[rectangle,thick,draw=black!75,
fill=black!10,minimum size=13mm]
\tikzstyle{every label}=[red]
\begin{scope}[xshift=0cm]
\node[]
at (-4, -2) (start) {};
\node[]
at (4, -2) (end) {};
\node [red place,tokens=0]
(w1') {};
\node [place] (c1') [below of=w1'] {};
\node [red place] (s1') [below of=c1',xshift=-15mm,label=left:$\xi_1$] {};
\node [red place,tokens=0]
(s2') [below of=c1',xshift=15mm,label=right:$\xi_2$] {};
\node [transition] (e1') [left of=c1'] {}
edge [post,bend left] (w1')
edge [post] (s1')
edge [pre] (s2')
edge [pre] (c1')
edge [pre,dotted] (start);
\node [transition] (l1') [right of=c1'] {}
edge [post] (c1')
edge [pre] (s1')
edge [post] (s2')
edge [pre,bend right] node[swap] {} (w1')
edge[post,dotted] (end);
\node[]
at (-2, -2) (c) {R101};
\node[]
at (2, -2) (c2) {R102};
\node[red]
at (0, +0.65) (c2) {$\xi_3$};
\node[blue]
at (0, -1.35) (c2) {$R$};
\node[black]
at (-5, -2) (c2) {make-up};
\node[black]
at (4.5, -2) (c2) {purge};
\end{scope}
\end{tikzpicture}
}
\end{figure}
答案1
只是为了证明元帖子也可用,这里有一个布局不同的版本。你更喜欢这个吗?这显示了你需要的东西吗?
\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path R, X[], reactor[];
R = fullcircle scaled 20 shifted 84 down;
X1 = fullcircle scaled 20 shifted 42 up;
X2 = fullcircle scaled 20 shifted 42 down;
X3 = fullcircle scaled 20 shifted 84 up;
reactor0 = unitsquare shifted -(1/2, 1/2) scaled 42;
reactor1 = reactor0 shifted 63 left;
reactor2 = reactor0 shifted 63 right;
forsuffixes $=1,2:
fill reactor$ withcolor 7/8 white;
draw reactor$;
label("R10" & decimal $, center reactor$);
endfor
fill R withcolor 3/4[blue, white];
draw R withcolor 1/2 blue;
label.top("$R$", point 2 of R) withcolor 1/2 blue;
forsuffixes $=1,2,3:
fill X$ withcolor 3/4[red, white];
draw X$ withcolor 1/2 red;
label.top("$\xi_{" & decimal $ & "}$", point 2 of X$) withcolor 1/2 red;
endfor
z1 = point -1/2 of reactor1 shifted 42 left;
z2 = point 3/2 of reactor2 shifted 42 right;
label.lft("make up", z1); drawarrow z1 -- point -1/2 of reactor1 dashed withdots scaled 1/2;
label.rt ("purge", z2); drawarrow point 3/2 of reactor2 -- z2 dashed withdots scaled 1/2;
forsuffixes $=X1,X3:
drawarrow center reactor1 {up} .. {right} center $
cutbefore reactor1 cutafter fullcircle scaled 22 shifted center $;
drawarrow center $ {right} .. {down} center reactor2
cutbefore $ cutafter reactor2 shifted 1 up;
endfor
forsuffixes $=R, X2:
drawarrow center reactor2 {down} .. {left} center $
cutbefore reactor2 cutafter fullcircle scaled 22 shifted center $;
drawarrow center $ {left} .. {up} center reactor1
cutbefore $ cutafter reactor1 shifted 1 down;
endfor
endfig;
\end{mplibcode}
\end{document}
用 编译它lualatex
。
答案2
当您要求改进代码时,我有一些建议:
- 您应该使用
\tikzset
而不是\tikzstyle
。阅读更多这里。 - 钛钾Z 已经为您提供了选项
scale
,因此使用\scalebox
不是非常 Ti钾Z 风格。 - 没有必要放置
scope
where 。xshift=0cm
- “补齐”和箭头之间的距离与“清除”和箭头之间的距离不同。这是小问题,但我们应该修复它。
- 来自“R101”的弯曲箭头看起来像是向下延伸了一点,然后才到达ξ3.指向“R102”的弯曲箭头似乎先上升一点,然后下降。
顺便说一句,我想向你展示我为该图编写的代码。我没有使用所有\node
s,也就是说,命令应该更容易理解(\draw
表示绘制某些东西,\node
表示要插入一些节点)。此外,这不使用任何笛卡尔/极坐标 –不同于 Ti钾其他图形工具中的 Z。
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=1.2,-stealth]
\tikzset{
reactor/.style={rectangle,thick,draw=black!75,fill=black!10,minimum size=13mm},
place/.style={circle,thick,draw=blue!75,fill=blue!20,minimum size=6mm},
red place/.style={place,draw=red!75,fill=red!20}
}
\node[place] (r) {} node[above=1em,blue!75] {$R$};
\node[reactor,left=1.5 cm of r] (101) {R101};
\node[reactor,right=1.5 cm of r] (102) {R102};
\node[red place,above=2 cm of r] (3) {};
\draw (3) node[above=1em,red] {$\xi_3$};
\node[red place,below=1.5cm of 101.south east] (1) {};
\draw (1) node[left=1em,red] {$\xi_1$};
\node[red place,below=1.5cm of 102.south west] (2) {};
\draw (2) node[right=1em,red] {$\xi_2$};
\node[left=2cm of 101] (start) {make-up};
\node[right=2cm of 102] (end) {purge};
\draw (101)--(1);
\draw (1)--(102);
\draw (102)--(r);
\draw (r)--(101);
\draw (101) to[out=90,in=180] (3);
\draw (3) to[out=0,in=90] (102);
\draw (102)--(2);
\draw (2)--(101);
\draw[dotted] (start)--(101);
\draw[dotted] (102)--(end);
\end{tikzpicture}
\end{document}