我希望能够在我的一篇论文中绘制一个漂亮的图表,但是,我很难找到一个教程来向我解释如何按照我的想法绘制图表。本文中的图 1 或多或少就是我所寻找的https://arxiv.org/pdf/1707.05398.pdf。有人知道如何在 latex 中实现这样的图表吗?我查过http://www.texample.net/tikz/但遗憾的是找不到任何相关内容。
答案1
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[font=\sf]
\node[draw,circle,label=below:$n_1$] (n1) at ({-sqrt(3)},-1){};
\node[draw,circle,label=above:$n_2$] (n2) at (0,2){};
\node[draw,circle,label=below:$n_3$] (n3) at ({sqrt(3)},-1){};
\node[draw,circle,label=above:$s_2$,label=below:$d_1$] (s2) at (-4,3){};
\node[draw,circle,label=above:$s_3$] (s3) at (4,3){};
\node[draw,circle,label=above:$s_1$] (s1) at (-4,-2){};
\node[draw,circle,label=above:$d_3$,label=below:$d_2$] (s4) at (4,-2){};
\draw[thick,-latex] (n1) -- (n2);
\draw[thick,-latex] (n1) -- (n3);
\draw[thick,-latex] (n2.-45) -- (n3.105);
\draw[thick,-latex] (n3.135) -- (n2.-75);
\draw[thick,-latex] (s1) -- (n1);
\draw[thick,-latex] (n3) -- (s4);
\draw[thick,-latex] (s3) -- (n2);
\draw[thick,-latex] (s2.-15) -- (n2.135);
\draw[thick,-latex] (n2.165) -- (s2.-45);
\draw[green,dashed,thick,-latex] (-4.2,3.2) .. controls ($(n2)+(0.5cm,1cm)$) and
($(n3)-(1cm,2cm)$) .. (4.2,-2.2);
\node at (-3,3.5) {Flow 2};
\draw[blue,dashed,thick,-latex] (4.2,3.2) .. controls ($(n2)+(0.5cm,-0.5cm)$) and
($(n3)-(0cm,0cm)$) .. (4.2,-2);
\node at (-3,1) {Flow 1};
\draw[red,dashed,thick,-latex] (-4.2,-2.2) .. controls ($(n1)-(0.15cm,0cm)$) and
($(n2)-(0.2cm,0cm)$) .. (-4.2,3.2);
\node at (3,1) {Flow 3};
\end{tikzpicture}
\end{document}