使用 tikz 绘制“发布或消亡”图片时遇到困难

使用 tikz 绘制“发布或消亡”图片时遇到困难

我正在尝试使用 tikz 复制以下图片。但我完全不知所措。您有什么建议吗?事实上,我甚至不确定是否可以使用 tikz。我能否决定图片的尺寸,比如宽度和高度?提前致谢。

在此处输入图片描述

答案1

Tikz 绝对可以做到这一点。这是一份草稿,您必须对其进行自定义,并且可能需要多了解一些有关 Tikz 的知识才能实现您的目标。

\documentclass[tikz,usenames,dvipsnames]{standalone}

\begin{document}
\begin{tikzpicture}
\draw[line width=5pt,Orchid!50!black] (0,0) node[left,black] {BEGIN} -- (8,0) arc (-90:90:1.5) -- (3.5,3) node[above,midway,black]{REPEAT};
\draw[line width=5pt,Orchid!50!black,->] (3.5,3)  arc (90:170:3);
\draw[Orchid!50!black,thick,fill=Orchid] (2,0) circle (.5cm) node[black,above,yshift=.5cm] {Idea};
\draw[Orchid!50!black,thick,fill=Orchid] (4,0) circle (.5cm) node[black,above,yshift=.5cm] {Research};
\draw[Orchid!50!black,thick,fill=Orchid] (6 ,0) circle (.5cm) node[black,above,yshift=.5cm] {Write};
\draw[OliveGreen!50!black,thick,fill=OliveGreen] (8,0) circle (.5cm) node[black,above,yshift=.5cm] {Publish};
\foreach \i in {1,3,5,7}{
\draw[Orchid!50!black,->,line width=5pt,line width=5pt] (\i,0) -- ++(1,-1.5) node[below,black] {Perish !};
}


\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

采用与 mvienney 的答案略有不同的方法,您可能会发现这更容易满足您的需求,因为它没有绝对坐标,只有几个相对坐标。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary[arrows,calc,positioning]
\begin{document}
\definecolor{interm-color}{rgb}{0.40,0.30,0.70}
\definecolor{final-color}{rgb}{0.30,0.50,0.10}
\sffamily
\begin{tikzpicture}[%
    track/.style={line width=3pt,color=interm-color},
    interm/.style={draw,line width=1pt,circle,minimum size=0.75cm,
                   color=interm-color,fill=interm-color!50!white},
    final/.style={draw,line width=1pt,circle,minimum size=0.75cm,
                  color=final-color,fill=final-color!50!white}
  ]
  \node (begin) {BEGIN};
  \node[interm,right=of begin] (idea) {};
  \node[above] at (idea.north) {Idea};
  \draw[track] (begin) -- (idea);
  \node[interm,right=of idea] (research) {};
  \node[above] at (research.north) {Research};
  \draw[track] (idea) -- (research);
  \node[interm,right=of research] (write) {};
  \node[above] at (write.north) {Write};
  \draw[track] (research) -- (write);
  \node[final,right=of write] (publish) {};
  \node[above] at (publish.north) {\textbf{Publish}};
  \draw[track] (write) -- (publish);
  \node[below=of idea] (p1) {Perish!};
  \draw[track,-stealth'] ($(idea.west) + (-0.5cm, 0)$) -- (p1);
  \node[below=of research] (p2) {Perish!};
  \draw[track,-stealth'] ($(research.west) + (-0.5cm, 0)$) -- (p2);
  \node[below=of write] (p3) {Perish!};
  \draw[track,-stealth'] ($(write.west) + (-0.5cm, 0)$) -- (p3);
  \node[below=of publish] (p4) {Perish!};
  \draw[track,-stealth'] ($(publish.west) + (-0.5cm, 0)$) -- (p4);
  \draw[track,-stealth'] (publish.east)
    arc [start angle=-90, end angle=90, radius=0.6cm]
    -- node[above,black] {REPEAT}
    ($(idea) + (0.6cm, 1.2cm)$)
    .. controls ($(idea) + (0, 1.2cm)$) and ($(idea) + (-0.8cm, +1.2cm)$) ..
    ($(idea.west) + (-0.5cm, +0.1cm)$);
\end{tikzpicture}
\end{document}

它产生了这个:

结果

答案3

为了好玩,一个简短的pstricks解决方案:

    \documentclass[12pt, a4paper, svgnames, x11names]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{pst-node}
    \usepackage{pgffor}
    \usepackage{auto-pst-pdf} % for pdflatex compilation. Requires pdflatex --enable-write18 (MiKTeX)
                                                    % or pdflatex -shell-escape (TeX Live, MacTeX)

    \begin{document}

    \psset{framearc=.2, framesep =3pt, arrowinset = 0, arrowsize = 8pt, dotsize=25pt, linejoin=1}
    \sffamily
    \def\pscolhookii{\quad}
    \begin{psmatrix}[rowsep=1, colsep=1.1, mnode =r]% defines the distance between two frames
    \rnode[r]{Beg}{BEGIN } & \pnode{I} & \pnode{R} & \pnode{W} & \pnode{Pu} \\
     & \rnode{PI}{Perish! } & \rnode{PR}{Perish! } & \rnode{PW}{Perish! } & \rnode{Peu}{Perish! }\\
     \psset{linewidth=0.7ex, linecolor =DarkOrchid4}
     \ncline[nodesepA=5pt]{Beg}{I}
     \foreach \D/\Text in {I/Idea, R/Research, W/Write, Pu/\textbf{Publish}}{\nput[labelsep=15pt]{90}{\D}{\Text}}
     \foreach\B/\E in {I/R, R/W, W/Pu} { \ncline{\B}{\E}}
     \psset{armA=1.2, angleB=120, arrows=->, nodesepB=3pt, linearc=0.7}
     \foreach\B/\E in {Beg/PI, I/PR, R/PW, W/Peu} {\ncdiagg{\B}{\E}}
     \nput[labelsep=1]{0}{Beg}{\pnode{EoL}}
     \ncangles[nodesepA=3pt, nodesepB=6pt, angleA=0,angleB=60, armA=1, armB=1.5]{Pu}{EoL}
     \nbput[npos=2.5, labelsep=2pt]{REPEAT}
     \foreach \D in {I, R, W}{\psdot[linecolor=Thistle3](\D)}
     \psdot[linecolor=OliveDrab](Pu)
    \end{psmatrix}

    \end{document} 

在此处输入图片描述

相关内容