按照@cfr 的建议,我从 0 开始制作 TikZ 图表,并指导我通过其他方法制作几个 pdf 和 TikZ 图表。
这是我的 TikZ LaTex:
\begin{tikzpicture}[
ell/.style 2 args={
ellipse,
minimum width=2.4cm,
minimum height=1cm,
draw,
label={[name=#1]center:#2}
},
connection/.style={thick,densely dotted, latex-latex}
]
\node [ell={A}{A }, fill=green!20] (a) at (1.5,1.0) {};
\node [ell={B}{B}, fill=blue!20] (b) at (1.5,-0.5) {};
\node [ell={C}{C}, fill=blue!20] (c) at (1.5,-2.0) {};
\node [ell={D}{D}, fill=blue!20] (d) at (1.5,-3.5) {};
\node [ell={E}{E}, fill=blue!20] (e) at (1.5,-5.0) {};
\node [ell={F}{F}, fill=blue!20] (f) at (1.5,-8.0) {};
\node [ell={G}{G}, fill=blue!20] (g) at (1.5,-9.5) {};
\node [ell={H}{H}, fill=blue!20] (h) at (1.5,-11.0) {};
\node [ell={I}{I},fill=red!20] (i) at (9.5, 1.0) {};
\node [ell={J}{J},fill=red!20] (j) at (9.5,-0.5) {};
\node [ell={K}{K},fill=red!20] (k) at (9.5,-2.0) {};
\node [ell={L}{L},fill=red!20] (l) at (9.5,-3.5) {};
\node [ell={M}{M},fill=red!20] (m) at (9.5,-5.0) {};
\node [ell={N}{N},fill=red!20] (n) at (9.5,-8.0) {};
\node [ell={O}{O},fill=red!20] (o) at (9.5,-9.5) {};
\node [ell={P}{P},fill=red!20] (p) at (9.5,-11.0) {};
\draw [->] (A)->(I);
\draw [->] (K)->(B);
\draw [->] (B)->(L);
\draw [->] (L)->(C);
\draw [->] (E)->(M);
\draw [->] (E)->(M);
\draw [dotted] (E)->(F);
\draw [dotted] (M)->(N);
\draw [->] (G)->(N);
\draw [->] (P)->(H);
\draw [-latex] (i.10) to[bend left] (j.5);
\draw [-latex] (j.10) to[bend left] (k.5);
\draw [-latex] (c.180) to[bend right] (d. -180);
\draw [-latex] (d.180) to[bend right] (e. -180);
\draw [-latex] (f.180) to[bend right] (g. -180);
\draw [-latex] (n.10) to[bend left] (o.5);
\draw [-latex] (o.10) to[bend left] (p.5);
%\draw [-latex] (a.300) to[bend right] (b.150);
\end{tikzpicture}
我尝试在开头写第一行,其中写着“pH1”,另外两行中间带有省略号,并且文本为“rho”,我该如何添加这两行?
再次问候,M
答案1
使用tikz
库calc
、chains
和:positioning
quotes
\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{calc, chains, positioning, quotes, shapes}
\begin{document}
\begin{tikzpicture}[auto=right,
node distance = 3mm and 18mm,
start chain = going below,
mynode/.style = {ellipse, draw, fill=cyan!70,
minimum width=12mm, inner sep=1pt,
on chain}
]
\foreach \i [count=\j] in {A,B,C,D,E,n,F,G,H}
{
\ifnum\j=6
\node[on chain] (\i) {$\vdots$}
\else
\node[mynode] (\i) {\i}
\fi;
}
\node[mynode, right=of A] (I) {I};
\foreach \i [count=\j from 0] in {J,K,L,M,n,N,O,P}
{
\ifnum\j=4
\node[on chain] (\i) {$\vdots$}
\else
\node[mynode] (\i) {\i}
\fi;
}
%
\coordinate[above=of $(A)!0.5!(I)$, label=pH1] (in);
%
\draw[-latex] (in) edge (A)
(A) edge (I)
(B) edge (L)
(K) edge (B)
(L) edge (C)
(E) edge (M)
(M) edge (E)
(G) edge (N)
(P) edge (H)
(C.west) edge [bend right] (D.west)
(D.west) edge [bend right] (E.west)
(F.west) edge [bend right] (G.west)
(I.east) edge [bend left] (J.east)
(J.east) edge [bend left] (K.east)
(N.east) edge [bend left] (O.east)
(O.east) to [bend left] (P.east);
\path (M) to coordinate[pos=0.3] (aux-1) coordinate[pos=0.7] (aux-2) (F);
\draw[-latex] (M) -- (aux-1)
(aux-2)-- (F);
\draw[dotted] (aux-1) to ["rho"] (aux-2);
\end{tikzpicture}
\end{document}
答案2
请不要抱怨节点的颜色。;-)
\documentclass[tikz, border=5]{standalone}
\usetikzlibrary{shapes,calc}
\begin{document}
\begin{tikzpicture}[murmel/.style={shape=ellipse,fill=blue!70!yellow!20!green!40,
minimum width=2cm,minimum height=0.5cm, draw,inner sep=0pt,align=center,text
width=1.9cm}]
\foreach \i [count=\y] in {A,...,H}
\node[murmel] (\i) at (0,-\y) { \i};
\foreach \i [count=\y] in {I,...,M}
\node[murmel] (\i) at (5,-\y) { \i};
\foreach \i [count=\y] in {N,...,P}
\node[murmel] (\i) at ($(5,-\y)+(0,-6)$) { \i};
\draw[-latex,bend right](C.west) to (D.west);
\draw[-latex,bend right](D.west) to (E.west);
\draw[-latex,bend right](F.west) to (G.west);
\draw[-latex,bend left](I.east) to (J.east);
\draw[-latex,bend left](J.east) to (K.east);
\draw[-latex,bend left](N.east) to (O.east);
\draw[-latex,bend left](O.east) to (P.east);
\draw[-latex](A.east) -- (I.west);
\draw[-latex](K.west) -- (B.east);
\draw[-latex](B.east) -- (L.west);
\draw[-latex](L.west) -- (C.east);
\draw[latex-latex](M.west) -- (E.east);
\draw[-latex](M.west) -- (F.east);
\draw[-latex](G.east) -- (N.west);
\draw[-latex](P.west) -- (H.east);
\draw[ultra thick, dotted](M.south) -- (N.north);
\end{tikzpicture}
\end{document}