曲折流程图

曲折流程图

我想要一个从上到下呈锯齿状移动的流程图。我以为我可以使用分层图和orient切换来实现,但这似乎不适合我。

到目前为止我已经:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard,graphdrawing,arrows, calc, positioning}
\usegdlibrary{layered}
\begin{document}
\begin{tikzpicture}[sibling distance=10mm,level distance=25mm,thick,
    nodes={draw,rectangle, fill=white,minimum width=30mm, minimum height=15mm, align=center,inner sep=0.5em}]


    \graph [layered layout] {%
        {gui/Circuit is \\designed in SPICE GUI}->[orient=right]
        {export/Netlist Exported \\and used to make Template in MATLAB} ->
        param/MATLAB takes Parameters->
        write_nl/ Writes Netlist to disk->
        call/Calls SPICE->
        run/Spice Simulates Circuit ->
        write_res/Writes Results to Disk ->
        read_res/ MATLAB Parses  Results from Disk->
        proc/Matlab Processes Results and Calculates Delays;

        {[same layer], gui, export};    
        {[same layer], param,write_nl,call};
        {[same layer], run,write_res};      
        {[same layer], read_res, proc};     

    };

\end{tikzpicture}
\end{document}

其结果为:

平坦的

但我想制作(请原谅我进行的可怕的剪切粘贴工作): 期望

答案1

正如cfr指出的那样,该chains库可以用于以下用途:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{chains}

\begin{document}
\begin{tikzpicture}
\begin{scope}[start chain=going right, every join/.style={->},
  every node/.style={draw, align=center, on chain, join, minimum height=1cm}]

\node {Circuit is \\ designed in SPICE GUI};
\node {Netlist Exported \\ and used to make Template in MATLAB};
\node [continue chain=going below] {MATLAB takes Parameters};
\node [continue chain=going left]  {Writes Netlist to disk};
\node {Calls SPICE};
\node [continue chain=going below] {Spice Simulates Circuit};
\node [continue chain=going right] {Writes Results to Disk};
\node [continue chain=going below] {MATLAB Parses  Results from Disk};
\node [continue chain=going left]  {Matlab Processes Results \\ and Calculates Delays};

\end{scope}
\end{tikzpicture}

\end{document}

在此处输入图片描述

使用以下方法可以使代码更加清晰\foreach

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}
\begin{scope}[start chain=going right, every join/.style={->},
  every node/.style={draw, align=center, on chain, join, minimum height=1cm}]

\foreach \direction/\text in {%
  right / Circuit is \\ designed in SPICE GUI,
  right / Netlist Exported \\ and used to make Template in MATLAB,
  below / Matlab takes Parameters,
  left  / Writes Netlist to disk,
  left  / Calls SPICE,
  below / Spice Simulates Circuit,
  right / Writes Results to Disk,
  below / MATLAB Parses  Results from Disk,
  left  / Matlab Processes Results \\ and Calculates Delays}
    \node [continue chain/.expanded=going \direction] {\text};

\end{scope}
\end{tikzpicture}

结果和以前一样。

相关内容