介绍

介绍

绘制简单流程图的方法有很多,比如使用 等包tikz。但最近我读了一篇而且看起来他们的复杂流程图并不是图片,而实际上是用 latex 生成的。如下所示:

在此处输入图片描述

编辑

我真的很想知道如何制作这样的图表,所以我提出了一个简化版本的概念: 在此处输入图片描述

根据现有的答案,我尝试用代码自己绘制一个类似概念的图形:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{xcolor}

\begin{document}

    \begin{tikzpicture}
        \tikzset{row1/.style={
                        minimum width=90pt,
                        minimum height=10pt,
                        draw}}
        \tikzset{row2/.style={
                        minimum width=90pt,
                        minimum height=100pt,
                        draw}}
        \tikzset{row3/.style={
                        minimum width=90pt,
                        minimum height=30pt,
                        draw}}
        \tikzset{round/.style={circle, 
                        draw=black!60, 
                        fill=orange!5, 
                        thick}}
        \tikzset{square/.style={rectangle, 
                        draw=black!60, 
                        fill=blue!5, 
                        thick}}
        \tikzset{arrow/.style={rectangle, 
                        draw=red!60, 
                        fill=red!5, 
                        thick}}
        \node[row1] (C1_1) {COL1};
        \node[row1, anchor=west] at (C1_1.east) (C2_1) {COL2};
        \node[row1, anchor=west] at (C2_1.east) (C3_1) {COL3};
        \node[row2, anchor=south, below=0] at (C1_1.south) (C1_2) {Some other text};
        \node[row2, anchor=south, below=0] at (C2_1.south) (C2_2) {Some other text};
        \node[row2, anchor=south, below=0] at (C3_1.south) (C3_2) {Some other text};
        \node[row3, anchor=south, below=0] at (C1_2.south) (C1_3) {Some other text};
        \node[row3, anchor=south, below=0] at (C2_2.south) (C2_3) {Some other text};
        \node[row3, anchor=south, below=0] at (C3_2.south) (C3_3) {Some other text};

        \node[square, below = -30] at (C1_2) (SA) {A};
        \node[square, below = -30] at (C2_2) (SB) {B};
        \node[square, below = -30] at (C3_2) (SC) {C};
        \node[square, below = 10] at (C3_2) (SD) {D};
        \node[round, below = 10] at (C2_2) (RO) {O};

        \draw[->] (SA) -- (SB);
        \draw[->] (SB) -- (SC);
        \draw[->] (SA) -- (RO);
        \draw[->] (SB) -- (RO);
        \draw[->] (RO) -- (SD);
    
    \end{tikzpicture}
    
\end{document}

以下是我所能达到的最佳身材:

在此处输入图片描述

看来它还需要大量的手动调整和改进。

我想知道如何编写更好的 latex 实现来绘制类似于我的概念或我发布的原始图形的东西。对于“更好”,我的意思是使我的实现更漂亮的方法,或者可能是节省所需手动调整的方法。

答案1

只是因为具有挑战性和不健康的乐趣,大约 160 行代码可能需要 4 个小时,尽管太阳已经升起了,无论如何,我希望它能鼓励那些刚开始的人,一切都可以做到,但需要时间和精力等。写下一些我甚至不记得的代码的快速参考页面。在分析您链接的文件时,我尝试将其分解为向量,但它有一个特殊之处,即它无法在向量编辑器中分解,我不知道原因,但既然它存在,就可以做到,有些东西可以在某处找到。

结果:

在此处输入图片描述

国家气象局:

\documentclass[tikz,border=20pt]{standalone}
\usepackage{xstring} % To put some dummy.
\usepackage{amsmath} % for equations
\usetikzlibrary{positioning,backgrounds,ducks,calc,arrows.meta,fit}

%CUSTOMIZED PALLETE OF COLORS USING A COLOR PICKER TOOL FOR THIRD PARTIES
\definecolor{GREEN}{HTML}{385723}
\definecolor{BLUE}{HTML}{2E5496}
\definecolor{BLUEB}{HTML}{5B9BD5}
\definecolor{BLUEC}{HTML}{4C7DAA}
\definecolor{ORANGE}{HTML}{F8CBAD}
\definecolor{GREY}{HTML}{D8D8D8}
% ALL THE POSTS OBTAINED BY ASKING FOR SOME CONTRETE QUESTION ON THE WEB.
%Tikz /.style with two parameters -> https://tex.stackexchange.com/q/21395/154390
%Tikz : node filling with text -> https://tex.stackexchange.com/q/117444/154390
% How can I get bold math symbols? -> https://tex.stackexchange.com/q/595/154390
% Is it possible to generate a set amount of words using lipsum? -> https://tex.stackexchange.com/q/462453/154390
% Bold, italics and underlining -> https://www.overleaf.com/learn/latex/Bold%2C_italics_and_underlining

\newcommand{\mystring}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
    vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
    mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
    Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
    et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
    metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
    eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
    quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
    faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. 
    Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue
    eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim
    rutrum.}
% Using \StrBefore[20]{\mystring}{ } its posible to put some number of words by this command.

\def\DUCK{% TO PUT DUCKS IN NODES
    \begin{tikz}
        \tikz\shuffleducks\duck[\randomhead,scale=0.3];
        \tikz\shuffleducks\duck[\randomhead,scale=0.3,xshift=1cm];
        \tikz\shuffleducks\duck[\randomhead,scale=0.3,xshift=-1cm];
    \end{tikz}
}
\def\MUX#1#2{% to no repeat the code of operators
        \node[circle,draw,inner sep=-0.5pt,minimum height =.5cm,line width=1.5pt,#1] (#2) {};
        \draw[line width=1.5pt] (#2.0)--(#2.180)(#2.90)--(#2.-90);
}

\begin{document}
    \begin{tikzpicture}[%Environment options
        BoxH/.store in=\BoxH,BoxH=10mm, % To avoid writin minimum height or width
        BoxW/.store in=\BoxW,BoxW=10mm,
        Arrow/.style 2 args= {draw=#1,-{Triangle[angle=120:.5cm 0.3,scale length=0.5*#2,scale width=0.3*#2]},line width=#2*1.2mm},
        H/.style 2 args= {draw=#1,rectangle,fill=#1,text=white,font=\sf\footnotesize,text width=#2, align=center},% H: For headers
        B/.style = {rectangle,text=black,font=\sf\tiny,text width=#1}, % B: for bodies
        L/.style = {draw=BLUEC,rectangle,text=white,font=\sf\scriptsize,text width=#1,fill=BLUEB,align=center,rounded corners=2pt}, % L: for learneable modules
        F/.style = {draw=#1,rectangle,fill=#1,minimum height=\BoxH, minimum width=\BoxW, inner sep=0}, % F: for features, all of these are nmonics to write fast and make code shorter.
    ]
    % Start drawing the thing.
    % Heads
    \node[H={BLUE}{3.7cm}](H1){Positional encodings (PE)};
    \node[H={BLUE}{3.7cm},right=1mm of H1](H2) {Structural encodings (SE)};
    \node[H={BLUE}{2.7cm},right=1mm of H2](H3) {Graph features};
    \node[H={GREEN}{4.5cm},right=1mm of H3](H4) {GPS layers};   
    %Bodies
    \node[B=3.9cm,below=1mm of H1, align=justify](PE-1){
        {\bfseries Local PE} \StrBefore[20]{\mystring}{ }\\ %inside a node when align is defined use \\ to jump to other line.
        \[
        \lim_{h \rightarrow 0 } \frac{f(x+h)-f(x)}{h}
        \]
        {\bfseries Relative PE} \StrBefore[20]{\mystring}{ }
    };
    
    \node[B=3.9cm,below=9.5cm of H1,align=justify](PE-2){
        {\bfseries DeepSet} \StrBefore[20]{\mystring}{ }\\
        \\
        {\bfseries SignNet} \StrBefore[20]{\mystring}{ }
    };
    %Second column
    \node[B=3.9cm,below=1mm of H2,align=justify](SE-1){
        {\bfseries Local PE} \StrBefore[20]{\mystring}{ }\\
        \[
        R^*=\sum_{i=1}^n|RX_i-Y_i\|^2_2,
        \]
        {\bfseries Batch-norm} \StrBefore[20]{\mystring}{ }
    };
    
    \node[B=3.9cm,below=9.5cm of H2, align=justify](SE-2){
        {\bfseries DeepSet} \StrBefore[20]{\mystring}{ }\\
        \\
        {\bfseries MLP} \StrBefore[20]{\mystring}{ }
    };
    %third column
    \node[B=2.9cm,below=1mm of H3, align=justify](GF-1){
        {\bfseries Nodes features} \StrBefore[10]{\mystring}{ }\\
        \\
        {\bfseries Global features} \StrBefore[10]{\mystring}{ }\\
        \\
        {\bfseries Edge features} \StrBefore[10]{\mystring}{ }
    };
        
    \node[B=2.9cm,below=9.5cm of H3, align=justify](GF-2){
        {\bfseries MPL} \StrBefore[15]{\mystring}{ }
    };
    %fourth column
    \node[B=4.7cm,below=1mm of H4, align=justify](GF-1){
        {\bfseries MPNN layer} \StrBefore[11]{\mystring}{ }\\
        {\bfseries Transformer layer} \StrBefore[15]{\mystring}{ }\\
        {\bfseries Residual connections} \StrBefore[10]{\mystring}{ }\\
        {\bfseries MLP} Some text \underline{underline}.\\
    };
    %Drawing Another nodes
    \node[L=1cm,below=3mm of PE-1](MLP){MLP};
    \node[F=ORANGE,BoxW=3.5cm, BoxH=8mm, below=3mm of MLP](MLP-1){\DUCK};
    \node[F=GREY,BoxW=3.5cm, BoxH=8mm, below=1mm of MLP-1](MLP-2){\DUCK};
    \node[F=GREY,BoxW=3.5cm, BoxH=8mm, below=1mm of MLP-2](MLP-3){\DUCK};
    \node[F=GREY!50!ORANGE,BoxW=2cm, BoxH=8mm, right=1mm of MLP-1](MLP-4){\DUCK};
    \node[L=1cm,right=5mm of MLP-4](MLP2){MLP};
    \node[L=1.3cm,below left=5mm and -18mm of MLP-3](BN){batch-norm};
    \node[L=1.3cm,below=3mm of BN](MLP3){MLP};
    \node[L=1.2cm,right=3mm of MLP3](SN){sign-net};
    \node[L=1.2cm,above=0.5mm of SN](DS){deep-set};
    \node[B=1.5cm,above=0.1mm of DS,align=center,inner sep=0](Text){any variable input size network};
    \MUX{below=3mm of SN}{op-1};
    \MUX{on grid,below=-2.5mm of op-1-|MLP2}{op-2};
    \MUX{on grid,right=3cm of op-2}{op-3};
    \MUX{on grid,right=2cm of op-3}{op-4};
    
    
    %drawing some Arrows
    
    \draw[Arrow={GREY}{1}](MLP-2.180) -- ++(-2mm,0) coordinate (temp) |- (BN.180);
    \draw[Arrow={GREY}{1}](BN) -- (MLP3);
    \draw[Arrow={GREY!50!ORANGE}{1}](MLP-4)--(MLP2);
    \draw[Arrow={GREY}{1}](MLP3) |- (op-1);
    \draw[Arrow={GREY}{1}](SN) -- (op-1);
    \draw[Arrow={GREY}{1.2}](op-1) -- (op-2);
    \draw[Arrow={GREY}{1.3}](op-2) -- (op-3);
    \draw[Arrow={GREY}{1.4}](op-3) -- (op-4);
    \draw[Arrow={GREY}{1}](MLP2)--(op-2);
    \draw[Arrow={ORANGE}{1}](MLP-1)--(MLP);
    \draw[Arrow={ORANGE}{1}](MLP)-|(op-4);
    
    %finishing
    \node[F=GREY!50!GREEN,BoxW=2.5cm, BoxH=4cm, right=10mm of op-4, align=center](END){\DUCK \\ \DUCK \\ \DUCK \\ \DUCK };
    \draw[Arrow={ORANGE}{1}](MLP)-|(op-4);
    \draw[Arrow={GREY!50!GREEN}{2}](op-4)--(END);
    %some use of fit
    
    \node[draw,BLUEB,line width=1pt,rounded corners,dashed,fit=(SN)(DS)(Text)]{};
    
    \begin{scope}[on background layer]% For the shadows boxes in background.
        \fill[GREY!15] (H1.south east)++(0,-1mm) rectangle (H1.south west|- PE-2.-90);
        \fill[GREY!15] (H2.south east)++(0,-1mm) rectangle (H2.south west|- PE-2.-90);
        \fill[GREY!15] (H3.south east)++(0,-1mm) rectangle (H3.south west|- PE-2.-90);
        \fill[GREEN!5] (H4.south east)++(0,-1mm) rectangle (H4.south west|- PE-2.-90);
    \end{scope}
    \end{tikzpicture}
    
\end{document}

额外的 如果你觉得有些手册太长,可以尝试视觉 tikz,你有代码和结果,这对我帮助很大。

答案2

如何概括地说,可能需要一些更精细的细节(如不透明度等),请参阅手册

1. 区分常见与不常见

如果你在脑海中去掉所有那些colors、rounded corners、arrow tips 等,绝大多数组件都是普通的节点和线,使用一些更丰富多彩的styles

剩下的是一些需要更多考虑的结构:

  • 带加号的圆圈
  • 4 个垂直颜色标度(最小..最大等)
  • 一些分层结构(绿色,右)
  • 一些标签(x L 等)
  • 图例(右下)
  • 类似化学的图形
  • 4 列具有“我在后台”效果

2. 处理异常部分的可能方法

通常,替代方案比我在这里列出的要多。这里只是列出如何实现它。

2.1 圆圈+加号

  • 可以是shape,即\node,带有一些“+”文本
  • 可以是\pic,只画一个圆和两个轴

因此,这\pic似乎是一种经常使用的结构。可以将其视为 Tikz 术语中的一种宏。

2.2 彩色鳞片

有一个淡化库,请参阅 pgfmanual。放置 0、最小值、最大值只是一步之\node遥,您可能会引入 3-4\pic秒或仅一两个使用arg值。

2.3 分层结构

pfgmanual 中有一整章介绍如何执行此操作。

2.4 放置标签...

... 一如既往\node地有效。

2.5 图例

可以单独进行,也许用列来解决会更好。

2.6 类化学图形

基本上,这些都是可以通过几个\foreach循环创建的简单对象(圆圈),其中可以包含单独的颜色(参见 pgfmanal)。

懒惰的解决方案会创建六个类似的\pics,里面有不同的颜色和标签。复杂的解决方案可能会一次性解决所有问题:@Qrrbrbirlbel 肯定会在这里展示一些技巧。

具有橙色背景的那些看起来非常相似,而对比似乎创造了不同的视觉感受。模糊的那些可能由更宽的线宽近似,或者由思维导图库精确匹配。这是一个平衡效果与努力的问题。

2.7 柱状结构

还有几种选择,例如:

  1. 将其视为一个大的 Tikz 绘图。即 place\node为标题,其他\node为文本(可以是且应该是 Latex: \node at (0,-2) {Local PE as node ...};)。您可能希望将这些列放在一个层内,参见上文。

  2. 当您可以为中间的 Tikz 绘图提供透明度时,您只需将绘图与任何合适的表格或小页面结构叠加即可。(我从未尝试过,但推测可以做到。)

答案3

介绍

这个答案为您想要的结果类型提供了快速启动,并提供了组织您的样式的一些方法。

为了组织我们的解决方案,我们将其分为 3 个文件:

  1. 主 mew 文件:mwe.tex
  2. 样式文件:myTikzsetStyle.sty
  3. TikZ 绘制文件:input_mwe_tikz.tex

请将它们全部保存在同一个文件夹中并编译mwe.tex

麦格

主文件很简单,它调用包tikz及其库;我们自己的样式文件和chemfig包。

您可以为您的化学品找到更合适的包装,或者在另一个软件中绘制它们并将其作为图形插入。

为了使化学图形的插入更加紧凑,便于以后更改,我定义了一个名为的命令\chemA。我们只需要更改其定义即可更改结果。这是基本概念,我们将在样式文件中返回。

mwe.tex 文件

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{shapes}
\usetikzlibrary{shapes.misc}

\usepackage{myTikzsetStyle}
\usepackage{chemfig}

\newcommand{\chemA}{
  \chemfig{[:75]R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}
}

\begin{document}
  \input{input_mwe_tikz}
\end{document}

myTikzsetStyle.sty

样式文件不仅可用于组织代码或文本,还可重复使用。

每个指令的最后一条指令tikzset定义/.default样式。其理念始终是定义/.default能够使用该样式而无需始终添加参数。

tikzset 包括:

  • addCrossX:在您为节点定义的图形上添加一个;
  • addSumaddCross:与+;相同
  • myBlock:定义标准块,可能存在多种变化;
  • mySimpleArrow:定义标准箭头;
  • myVecArrow:定义一个箭头,其边缘和中间的颜色不同;
  • myInnerColor:有助于保持myVecArrow连接下的内部颜色一致;
  • myVecArrowColor:特殊情况,用于myVecArrow特殊连接;
  • myInnerNonWhite:与 一起使用,myVecArrowColor用于连接;
  • figNode:定义插入外部图形的方式。

为了插入上述文本,我选择使用newcommand替代方法来创建一个用于添加文本的命令:

myTikzsetStyle.sty 文件

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{myTikzStyle}[2023-12-03 Custom Package to draw my own styles with TikZ]

\tikzset{addCross/.style n args={6}{
    minimum size={#5 mm}, %minimum height=10mm,
    path picture={
      \draw[#6]
      (path picture bounding box.south east) -- (path picture bounding box.north west)
      (path picture bounding box.south west) -- (path picture bounding box.north east);
      \node at ($(path picture bounding box.south)!0.4!(path picture bounding box.center)$) {#1};
      \node at ($(path picture bounding box.west)!0.4!(path picture bounding box.center)$)  {#2};
      \node at ($(path picture bounding box.north)!0.4!(path picture bounding box.center)$) {#3};
      \node at ($(path picture bounding box.east)!0.4!(path picture bounding box.center)$)  {#4};
    }
  },
  addCross/.default={}{}{}{}{10}{}
}
\tikzset{addSum/.style n args={6}{
    minimum size={#5 mm}, %minimum height=10mm,
    path picture={
      \draw[#6]
      (path picture bounding box.south) -- (path picture bounding box.north)
      (path picture bounding box.west) -- (path picture bounding box.east);
      \node at ($(path picture bounding box.south west)!0.6!(path picture bounding box.center)$) {#1};
      \node at ($(path picture bounding box.south east)!0.6!(path picture bounding box.center)$)  {#2};
      \node at ($(path picture bounding box.north west)!0.6!(path picture bounding box.center)$) {#3};
      \node at ($(path picture bounding box.north east)!0.6!(path picture bounding box.center)$)  {#4};
    }
  },
  addSum/.default={}{}{}{}{10}{black}
}
\tikzset{myBlock/.style n args={2}{
    every node/.style={rectangle,draw, text=black,
      minimum width=#1, minimum height=#2,}
  },
  myBlock/.default={1cm}{1cm}
}
\tikzset{mySimpleArrow/.style n args={2}{
    >={latex[#1]},
    every path/.style={draw=#2}
  },
  mySimpleArrow/.default={black}{black}
}
\tikzset{myVecArrow/.style n args={4}{
    thick, #1, decoration={markings, mark=at position
      1 with {\arrow[semithick, #2]{triangle 60[fill=#3]}}}, % open triangle
    double distance=1.4pt, shorten >= 5.5pt,
    preaction = {decorate},
    postaction = {draw,line width=1.4pt, #4, shorten >= 4.5pt}
  },
  myVecArrow/.default={black}{black}{white}{white}
}
\tikzset{myInnerColor/.style={
    semithick, #1, line width=1.4pt, shorten >= 4.5pt
  },
  myInnerColor/.default={white}
}
\tikzset{myVecArrowColor/.style={
    myVecArrow={red}{blue}{orange}{green}}
}
\tikzset{myInnerNonWhite/.style={
    myInnerColor={cyan}}
}
\tikzset{figNode/.style={
    path picture={
      \node at (path picture bounding box.center) {#1};}}
}

\newcommand{\myTextTable}[5][]{
  \begin{scope}[#1]
    \node[rectangle, fill=#2, text=#3, text centered, minimum width=80, minimum height=10] at (0,0.5) {
      \begin{tabular}{c}
        \textbf{#4}
      \end{tabular}
    };
    \node[minimum width=20, minimum height=10, align=left, text width = 0.25\textwidth, anchor=north] at (0,0) {
        {#5}
    };
  \end{scope} 
}

输入_mwe_tikz.tex

关键思想始终是定义最大可能的共同特征集,意思是,使用带参数的环境作用域。

在第一个区块,有一些红色虚线矩形,其中一个用绿色填充。

第二个块是应用紫色的圆形节点。在这里我添加了addCrossaddSum自己的样式。注意它在哪里变成紫色,哪里没有变成紫色。

第三个块是使用样式的节点集myBlock。这通常是第一个要绘制的块,并定义其元素的位置。在这里我插入了两个使用 的节点figNode和另一个使用 的节点。

第四个块包含的基本集mySimpleArrow,后面跟着foreach循环中的第五个块来插入myVecArrow,这是一个特殊的箭头,中间有一个彩色空间。

在序列中,有一个myVecArrow带有参数的,后面跟着一个foreach带有myVecArrowColor和的myInnerNonWhite。请注意箭头在分叉处如何完美结合。只需忽略不寻常的配色方案即可。

最后,最后一个块是使用 的上述文本\myTextTable。由于我们会多次使用相同的样式,因此我们定义了一个命令,该命令可以更改某些功能,而无需一遍又一遍地重复整个代码。如果需要进行任何更改,我们只需在命令定义中进行更改即可。

input_mwe_tikz.tex 文件

\begin{tikzpicture}[very thick]
  \begin{scope}[dashed, red]
    \draw (-3,-2.25) rectangle ++(5,3.25);
    \draw[fill opacity=0.4,fill=green!50] (-4.5,2.25) rectangle ++(8,3.5);
  \end{scope}
  
  \begin{scope}[purple]
    \node[circle,draw,addCross={$+$}{$+$}{}{}{10}{black}] (N1) at (-2,0) {};
    \node[addSum] (N2) at (5,0) {};
    \node[circle,draw,addSum={1}{2}{3}{4}{10}{blue}] (N3) at (5,-2) {};
  \end{scope}

  \begin{scope}[myBlock]
    \node (A) at (0,-1.5) {A};
    \node (B) at (-4,0) {B};
    \node[figNode={\includegraphics[width=1cm]{example-image-c}}] (C) at (3,0) {};
    
    \node[figNode={\includegraphics[width=1cm]{example-image-duck}}] (D) at (-3,4) {};
    \node (chemA) at (0.5,4) {\chemA};
    
    \node (I) at (0,0) {$\displaystyle \int$};
  \end{scope}
  
  \begin{scope}[mySimpleArrow]
    \path[->] ($(B)+(-1.5,0)$) node[above]{$u$} -- (B);
    \path[->] (B) -- (N1);
    \path[->] (N1) -- (I) node[midway, above] {$\dot{x}$};
    
    \path[->] (I) -- ++(1.5,0) coordinate(x) node[above]{$x$} -- (C);
    \path[->] (x) |- (A) -| (N1);
    
    \path[->] (C) |- (N3) node[below,midway]{$\hat{z}$};
    \path[->] (N3) -- ++(1.5,0) node[above]{$z$};
  \end{scope}
  
  \foreach \f in {myVecArrow}{
    \draw[\f] (B) |- (D);
    \draw[\f] (C) -- (N2) node[above,midway]{$\hat{y}$};
    \draw[\f] (N2) -- ++(1.5,0) node[above]{$y$};
  };
  
  \draw[myVecArrow={cyan}{red}{violet}{violet}] (D) -- (chemA);
  
  \foreach \f in {myVecArrowColor,myInnerNonWhite}{
    \draw[\f] (chemA) -| (C);
    \draw[\f] (chemA) -| (N2);
  };
  
  \begin{scope}[shift={(-3,8)}]
    \myTextTable{blue}{white}{\Large{Title A}}{Text 1.}
    \myTextTable[shift={(3,0)}]{blue}{white}{\Large{Title B}}{Text 2.}
    \myTextTable[shift={(6,0)}]{green!50!black}{white}{\Large{Title C}}{This is a very long text, yet not so long.}
  \end{scope}
\end{tikzpicture}

结果

下图展示了我们的结果。

在此处输入图片描述

相关内容