在 tikz 节点之间绘制圆形线

在 tikz 节点之间绘制圆形线

考虑以下 MWE:

\documentclass[tikz]{standalone}

\begin{document}
  \usetikzlibrary{shapes}
  \tikzset{every picture/.append style={auto,
      line width=1pt, >=stealth,  font=\small}}
  \begin{tikzpicture}[x=1mm,y=1mm]%
       \node[ellipse,draw,align=left] at (65:40mm) (AA){citric\\acid};
    \node[ellipse,draw,align=left] at (20:40)(BB){ISOcitric\\acid};
    \node[ellipse,draw,align=left] at (335:40)(CC)
                     {\( \alpha \)-ketoglu-\\taric acid};
    \node[ellipse,draw,align=left] at (290:40)(DD){succinyl-\\CoA};
    \node[ellipse,draw,align=left] at (245:40)(EE){succinate};
    \node[ellipse,draw,align=left] at (200:40)(FF){fumarate};
    \node[ellipse,draw,align=left] at (155:40)(GG){malate};
    \node[ellipse,draw,align=left] at (110:40)(HH){oxalo-\\acetate};

    
    \draw[->](AA) to[bend left=15](BB);
    \draw[->](BB) to[bend left=15](CC);
    \draw[->](CC) to[bend left=15](DD);
    \draw[->](DD) to[bend left=15](EE);
    \draw[->](EE) to[bend left=15](FF);
    \draw[->](FF) to[bend left=15](GG);
    \draw[->](GG) to[bend left=15](HH);
    \draw[->](HH) to[bend left=15](AA);

  \end{tikzpicture}
\end{document}

在此处输入图片描述

你们中的许多人会认识到这是柠檬酸循环描述的开始。我觉得这是可以接受的,但如果节点之间带有箭头的线实际上遵循用于放置节点的圆圈,那就更好了。

如何才能做到这一点?

答案1

简化一下,使所有节点都变成圆形。

\documentclass[tikz,border=1.618]{standalone}

\begin{document}
\begin{tikzpicture}
% dimensions:
\def\br{4.5} % big  radius
\def\lr{0.9} % node radius
% intersection point and angle:
\pgfmathsetmacro\x{\br-0.5*\lr*\lr/\br}
\pgfmathsetmacro\y{sqrt(\br*\br-\x*\x))}
\pgfmathsetmacro\sa{atan(\y/\x)}
% only for comparison:
\draw[gray,very thin] (0,0) circle (\br);
% diagram:
\foreach[count=\i]\j in {ISOcitric\\acid,citric\\acid,oxalo-\\acetate,malate,
                         succinate,fumarate,succinyl-\\CoA,\(\alpha\)-ketoglu-\\taric acid}
{
  \begin{scope}[rotate=45*\i-22.5]
    \draw[thick] (\br,0) circle (\lr);
    \node[text width=2cm,align=center] at (\br,0) {\j};
    \draw[latex-,thick] (\sa:\br) arc (\sa:45-\sa:\br);
  \end{scope}
}
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

在研究了一段时间的 tikz 手册后,我找到了属性 'looseness',可以将其应用于 '向左弯曲'。结果如下,粗红圈为帮助圈。

\documentclass[tikz]{standalone}

\begin{document}
  \usetikzlibrary{shapes}
  \tikzset{every picture/.append style={auto,
      line width=1pt, >=stealth,  font=\small}}
  \begin{tikzpicture}[x=1mm,y=1mm]%
    \draw[red!40,line width=2pt](0,0)circle[radius=40mm];
    \node[ellipse,draw,align=left] at (65:40mm) (AA){citric\\acid};
    \node[ellipse,draw,align=left] at (20:40)(BB){ISOcitric\\acid};
    \node[ellipse,draw,align=left] at (335:40)(CC)
    {\( \alpha \)-ketoglu-\\taric acid};
    \node[ellipse,draw,align=left] at (290:40)(DD){succinyl-\\CoA};
    \node[ellipse,draw,align=left] at (245:40)(EE){succinate};
    \node[ellipse,draw,align=left] at (200:40)(FF){fumarate};
    \node[ellipse,draw,align=left] at (155:40)(GG){malate};
    \node[ellipse,draw,align=left] at (110:40)(HH){oxalo-\\acetate};
    
    
    \draw[->](AA) to[bend left=15,looseness=0.7](BB);
    \draw[->](BB) to[bend left=15,looseness=0.7](CC);
    \draw[->](CC) to[bend left=15,looseness=0.7](DD);
    \draw[->](DD) to[bend left=15,looseness=0.7](EE);
    \draw[->](EE) to[bend left=15,looseness=0.9](FF);
    \draw[->](FF) to[bend left=15](GG);
    \draw[->](GG) to[bend left=15,looseness=0.9](HH);
    \draw[->](HH) to[bend left=15,looseness=0.7](AA);
    
  \end{tikzpicture}
\end{document}

结果如下:

在此处输入图片描述

相关内容