在 LaTeX 中绘制图表

在 LaTeX 中绘制图表

我对 LaTeX 完全陌生。我试图绘制附件图形在 LaTeX 中使用介绍,但却迷路了。

不知道如何用文字绘制箭头。

我的尝试

    \documentclass{article}



    \usepackage{tikz}
    \usetikzlibrary{positioning,decorations.markings,quotes}
    \begin{document}
    \begin{tikzpicture}[
   dot/.style = {circle, draw, fill, inner sep = 2pt},
   dot1/.style = {circle, draw, fill, inner sep = 1pt},
   decoration = {
     markings,
     %mark = at position 0.5 with {\pgftransformscale{2}}
     },
   ]
   \node (gamma-a) [dot, "initial position"] {};
   \node (gamma-b) [above right = 2cm and 6 cm of gamma-a, dot] {};
   \node (gamma-c) [above right = 2.25cm and 6.5 cm of gamma-a, dot1] {};
   \node (gamma-d) [above right = 1.9cm and 5.75 cm of gamma-a, dot1] {};
   \node (gamma-e) [below right = -0.5cm and 6 cm of gamma-a, "$\varepsilon$-neighbourhood"] {};
   \node (gamma-f) [above right = 1.4cm and 7 cm of gamma-a, "destination"] {};
   \draw [postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -30, in = 120] (gamma-b);
   \draw [color = green, dashed, postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -5, in = 110] (gamma-c);
   \draw [color = blue, dashed, postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -45, in = 150] (gamma-d);
   \draw [color = gray, dashed](gamma-b) circle (0.8cm);
\end{tikzpicture}



    \end{document}

答案1

完整代码如下:

\begin{tikzpicture}[
   dot/.style = {circle, draw, fill, inner sep = 2pt},
   dot1/.style = {circle, draw, fill, inner sep = 1pt},
   decoration = {
     markings, 
     },
   ]
   \node (gamma-a) [dot, "initial position"] {};
   \node (gamma-b) [above right = 2cm and 6 cm of gamma-a, dot] {};
   \node (gamma-c) [above right = 2.25cm and 6.5 cm of gamma-a, dot1] {};
   \node (gamma-d) [above right = 1.9cm and 5.75 cm of gamma-a, dot1] {};
   \node (gamma-e) [below right = -0.75cm and 6 cm of gamma-a, "$\varepsilon$-neighbourhood"] {};
   \node (gamma-f) [above right = 1.4cm and 7 cm of gamma-a, "destination"] {};
   \node (gamma-g) [above right = 1.25cm and 1.5 cm of gamma-a, "exact controllable"] {};
   \node (gamma-e) [above right = 3.25cm and 4.75cm of gamma-a, "approximate controllable"] {};
   \draw [postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -30, in = 120] (gamma-b);
   \draw [color = green, dashed, postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -5, in = 110] (gamma-c);
   \draw [color = blue, dashed, postaction = {decorate}, line width = 1pt] (gamma-a)
     to [out = -45, in = 150] (gamma-d);
   \draw [color = gray, thick, dashed](gamma-b) circle (0.8cm);
   \draw[-Latex] (1.51,0)--(2,1.5) node[right]{};
   \draw[-Latex] (4.91,2.25)--(4.5,3.5) node[right]{};
   \draw[-Latex] (5.52,3.1)--(5.1,3.5) node[right]{};
\end{tikzpicture}

感谢您的关注!

在此处输入图片描述

答案2

这可能不是最好的解决方案,但它提供了很大的灵活性。因此,我建议删除节点创建时的文本,如下所示:

\node (gamma-a) [dot] {};

然后,放置完所有节点后,您就可以使用节点作为起始坐标随意绘制箭头。

\draw[->]  (gamma-a) -- ++(-1,-1) coordinate(ref-a);

最后,使用箭头末端坐标(ref-a),您可以将文本放置在您喜欢的位置。

\draw (ref-a) ++(-0.5,-0.5) node[]{inital position};

希望它是有用的。

相关内容