如何在 tikz 中绘制此图形

如何在 tikz 中绘制此图形

我刚开始使用 latex。我想用 tikz 画图。以下是图 行走模式

答案1

以下是下图的 MWE。它使用了绘制最终图形所需的所有工具:

  • 定义节点、形状和标签;
  • 定义边缘,具有各种样式、弯曲和标签;
  • 定义样式并继承属性;
  • 使用笛卡尔和极坐标以及相对定位;
  • 使用数学模式;
  • 对整个 tikz 图片使用全局设置。

要进一步了解 TikZ,请查看PGF 手册:在介绍中有非常好的分步示例。

在此处输入图片描述

\documentclass{standalone}
    \usepackage{tikz}
        \usetikzlibrary{shapes}
        \usetikzlibrary{positioning}

\begin{document}
    \begin{tikzpicture}[
        center-ellipe/.style={
                shape=ellipse,
                draw= red,
                fill=pink,
                dashed
            },
        outside-ellipse/.style={
                shape=ellipse,
                draw= black,
                fill= gray,
                align = center,
            },
        desirable/.style={
                blue,
                ->,
                >=stealth,
                bend left = 30,
            },
        undesirable-straight/.style={
                blue,
                dashed,
                ->,
                >=stealth,
            },
        undesirable/.style={
                undesirable-straight,
                bend right,
            },
        arrow-label/.style={
                font=\small,
                text=gray,
            },
        arrow-start-label/.style={
                arrow-label,
                very near start
            },
        arrow-end-label/.style={
            arrow-label,,
            very near end
        },  
        xscale=3,
        yscale=3,
    ]

        \node (center)   at   (0,0) [center-ellipe]   {Fall};
        \node (circle_t) at  (30:1) [outside-ellipse] {T\\Lorem\\$ipsum$}; %NB: using $<content>$ is for entering math mode content, and should NOT be used for using an italicized typeface (therefor, use \emph{<content>} instead).
        \node (circle_f) at (150:1) [outside-ellipse] {F\\Lorem\\$ipsum$};
        \node (circle_h) at (-90:1) [outside-ellipse] {$h$\\Lorem\\$ipsum$};

        \draw [desirable] (circle_t) edge 
            node [arrow-start-label, right] {Lorem}
            node [arrow-end-label  , below right]   {Ipsum}
        (circle_h);
        \draw [desirable] (circle_f) edge 
            node [arrow-start-label, above] {$x^{-}_{f} \in S^{t}_{f}$}
            node [arrow-end-label  , above]   {Ipsum}
        (circle_t);
        \draw [undesirable] (circle_f) to (circle_h);
        \draw [undesirable-straight] (circle_h) to (center);
    \end{tikzpicture}
\end{document}

相关内容