如何绘制 RG 流

如何绘制 RG 流

我怎样才能在乳胶中绘制这个图形?在此处输入图片描述

来源:Giuseppe Mussardo - 统计场论中的图 8.3

答案1

有两种简单的方法可以实现曲线。您可以像这样定义线相对于节点的起点和终点的角度:

\draw (A) to[out=80,in=130] (B);

或者你可以使用贝塞尔曲线来获得更多的控制,如下所示:

\draw (A) .. controls (1,-.5) .. (B);

中间的箭头可以通过装饰来实现,而字母则可以通过label在节点上使用 s 来实现。

下面是一个说明如何执行此操作的起点:

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}

\begin{document}
    \begin{tikzpicture}[
        edge/.style={circle,fill,minimum size=1.5mm,inner sep=0pt},
        every path/.style={draw,thin,decoration={markings,mark = at position 0.5 with {\arrow{>}}},>=stealth},
        every label/.style={font=\footnotesize\sffamily},
        x=1cm,y=1cm]
        \node[edge,label=93:A] (A) at (0,0) {};
        \node[edge,label=15:B] (B) at (2,0.5) {};
        \node[edge,label=89:C] (C) at (1,-1) {};
        
        \path[postaction={decorate}] (A) -- (B);
        \path[postaction={decorate}] (A) -- (C);
        \path[postaction={decorate}] (C) -- (B);
        
        % Using angles
        \draw[postaction={decorate}] (A) to[out=80,in=130] (B);
        
        % Using Bezier curves
        \draw[postaction={decorate}] (A) .. controls (1,-.5) .. (B);
    \end{tikzpicture}
\end{document}

此代码将产生如下结果:

在此处输入图片描述

编辑:如果您想节省一些时间和重复的代码行,您可以使用\foreach循环来优化它,例如:

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}

\begin{document}
    \begin{tikzpicture}[
        edge/.style={circle,fill,minimum size=1.5mm,inner sep=0pt},
        every path/.style={draw,thin,decoration={markings,mark = at position 0.5 with {\arrow{>}}},>=stealth},
        every label/.style={font=\footnotesize\sffamily},
        x=1cm,y=1cm]
        \node[edge,label=93:A] (A) at (0,0) {};
        \node[edge,label=15:B] (B) at (2,0.5) {};
        \node[edge,label=89:C] (C) at (1,-1) {};
        
        \foreach \i/\j in {A/B, A/C, C/B}{
            \path[postaction={decorate}] (\i) -- (\j);
        }

        % Using angles
        \foreach \i/\j in {80/130, 350/220}{
            \draw[postaction={decorate}] (A) to[out=\i,in=\j] (B);
        }
        
        % Using Bezier curves
        \draw[postaction={decorate}] (A) .. controls (1,-.5) .. (B);
    \end{tikzpicture}
\end{document}

相关内容