使用 Tikz 绘制彩色框图

使用 Tikz 绘制彩色框图

带颜色和箭头的图表代码如下:

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{chains,fit}
\begin{document}
\begin{tikzpicture}[node distance=.8cm, start chain=going below, punktchain/.style={rectangle, rounded corners, draw=black, very thick, text width=25em, minimum height=3em, text centered, on chain},every join/.style={->, thick,shorten >=1pt}]
 \begin{scope}[nodes={join, punktchain}]
 \node (1) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (2) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (3) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (4) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (5) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (6) {aaaaaaaaaaaaaaaaaaaaaaa};
 \node (7) {aaaaaaaaaaaaaaaaaaaaaaa};
 \end{scope} 
\end{tikzpicture}
\end{document}

那么结果看起来并不像我预期的那样: 在此处输入图片描述

那么,我将非常感激任何建议!

答案1

您的 MWE 与您的图像关系不大,这里有一个chains带有库的解决方案。

\documentclass[tikz,border=1cm]{standalone}
\usetikzlibrary{chains,positioning}
\usetikzlibrary{arrows.meta}
\tikzset{
    punktchain/.style={rectangle,draw=cyan,
        fill=cyan!30!white,
        very thick, text width=20em, minimum height=3em, text centered},
    darknode/.style={fill=cyan!70!green, draw=cyan},
    mednode/.style={minimum height=5em},
    bignode/.style={minimum height=12em},
    myarrow/.style={-{Triangle}, very thick, shorten >=1pt},
    every join/.style={myarrow},
    }
\begin{document}
\begin{tikzpicture}[nodes={punktchain}]
\begin{scope}[start chain,nodes={join, on chain}]
    \node[bignode, darknode] (A) {aaaaaaaaaaaaaaaaaaaaaaa};
    \node (B) {aaaaaaaaaaaaaaaaaaaaaaa};
    \node[bignode] (1) {aaaaaaaaaaaaaaaaaaaaaaa};
    \begin{scope}[nodes={on chain=going below}]
        \node (2) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node[mednode] (3) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node[mednode] (4) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node (5) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node[mednode] (6) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node[mednode] (7) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node (8) {aaaaaaaaaaaaaaaaaaaaaaa};
        \node (9) {aaaaaaaaaaaaaaaaaaaaaaa};
    \end{scope}
    \node (10) {aaaaaaaaaaaaaaaaaaaaaaa};
\end{scope} 
\node[anchor=south, darknode] (C) at (A.south -| B) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (C.east) -- (C -| 1.west);
\node[right = of 2] (R2) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (2) -- (R2);
\draw[myarrow] (R2) |- (3);
\node[above=of R2, darknode] (R1) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (R1) -- (R2);
\node[left=of 3, darknode] (L3) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (L3) -- (3);
\node[left=of 4, darknode, mednode] (L4) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (L4) -- (4);
\node[left=of 6, darknode, mednode] (L6) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (L6) -- (6);
\node[left=of 7, darknode, mednode] (L7) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (L7) -- (7);
\node[left=of 8, mednode] (L8) {aaaaaaaaaaaaaaaaaaaaaaa};
\draw[myarrow] (L8) -- (8);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容