tikz pgf:绘制状态图

tikz pgf:绘制状态图

我想用 tikz pgf 重现以下图像,但不确定如何操作:

在此处输入图片描述

我对这张平淡无奇的画感到非常抱歉,我对 tikz pgf 了解甚少,因为我对这样的东西还不熟悉。我看了网站,但由于图表太复杂,我无法按照提供的图表建模。有人能帮我创建一个带有图例的图表吗?非常感谢!

编辑:

    \documentclass[tikz, margin=3mm]{standalone}
    \usetikzlibrary{arrows.meta}
    
    \begin{document}
        \begin{center}
     \resizebox{11cm}{7.5cm}{%
     \begin{tikzpicture}[
C/.style = {circle, draw, thick, minimum size=3.4em, inner sep=1pt},
arr/.style = {-Triangle, semithick, color=#1, shorten >=2pt, shorten <=2pt},
state/.style={circle, thick, draw=blue!75, fill=blue!20, minimum size=6mm}
                        ]
\node (c0) [C]  at (  0:2.4) {$\frac{1}{1-x}$};
\node (c1) [state]  at ( 60:2.4) {$1-x$};
\node (c2) [C]  at (120:2.4) {$x$};
\node (c3) [state]  at (180:2.4) {$\frac{1}{x}$};
\node (c4) [C]  at (240:2.4) {$1-\frac{1}{x}$};
\node (c5) [C]  at (300:2.4) {$\frac{x}{x-1}$};
%
\foreach \i in {0,2,4}
{
\pgfmathsetmacro{\j}{int(\i+1)}
\draw[arr=teal] (c\i) edge [bend left] (c\j)
                (c\j)  to  [bend left] (c\i);
}
\path[draw=teal, very thick] 
    ([shift={(-2.5,0.5)}] c2.west) node[right] {$g(x)=\frac{1}{x}$} -- ++ (-0.5,0);
%
\foreach \i in {1,3,5}
{
\pgfmathsetmacro{\j}{int(Mod(\i+1,6))}
\draw[arr=orange]   (c\i) edge [bend left] (c\j)
                    (c\j)  to  [bend left] (c\i);
}
\path[draw=orange, very thick] 
    ([shift={(-2.5,0.0)}] c2.west) node[right] {$f(x)=1-x$} -- ++ (-0.5,0);
    \end{tikzpicture}
} 
\end{center}
    \end{document}

我对图例、适合页面的大小和颜色做了一些小改动。但是,其中一个蓝色圆圈不统一(来自 state/.style),我不知道该怎么办。谢谢!

答案1

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
    \begin{tikzpicture}[
C/.style = {circle, draw, thick, minimum size=3.4em, inner sep=1pt},
arr/.style = {-Triangle, semithick, color=#1, shorten >=2pt, shorten <=2pt}
                        ]
\node (c0) [C]  at (  0:2.4) {$\frac{1}{1-x}$};
\node (c1) [C]  at ( 60:2.4) {$1-x$};
\node (c2) [C]  at (120:2.4) {$x$};
\node (c3) [C]  at (180:2.4) {$\frac{1}{x}$};
\node (c4) [C]  at (240:2.4) {$1-\frac{1}{x}$};
\node (c5) [C]  at (300:2.4) {$\frac{x}{x-1}$};
%
\foreach \i in {0,2,4}
{
\pgfmathsetmacro{\j}{int(\i+1)}
\draw[arr=teal] (c\i) edge [bend left] (c\j)
                (c\j)  to  [bend left] (c\i);
}
\path[draw=teal, very thick] 
    ([shift={(-1.5,0.5)}] c2.west) node[right] {$g(x)$} -- ++ (-0.5,0);
%
\foreach \i in {1,3,5}
{
\pgfmathsetmacro{\j}{int(Mod(\i+1,6))}
\draw[arr=orange]   (c\i) edge [bend left] (c\j)
                    (c\j)  to  [bend left] (c\i);
}
\path[draw=orange, very thick] 
    ([shift={(-1.5,0.0)}] c2.west) node[right] {$f(x)$} -- ++ (-0.5,0);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容