编辑

编辑

这是我想用 TikZ 重新制作的流程图类型图形。 图像

原则上,我知道如何使用\node (a) at (1,2) { text };\draw (a) -- (b);命令来做这些事情。但是,我对这种方法不太满意。我有以下担忧:

  • 这里的图形非常繁忙,我担心我会被所有的节点和箭头弄糊涂。
  • 流程图的各个部分被“刻入”其他节点 - 彩色节点和箭头始终封装在灰色节点和箭头内。我不确定如何处理这个问题 - 我应该将“小”流程图放在tikzpicture“外部”流程图的节点内吗,还是有更优雅的解决方案?如果我将其拆分成几个tikzpicture,如何确保对齐按预期进行?
  • 左侧的大节点用虚线分成“部分”。最好的处理方法是什么?我应该自己用 绘制节点(和“部分”)吗draw ... rectangle ...,还是有其他不错的方法来“细分” TikZ 节点?
  • 左侧的小彩色节点是多色的 - 如何用 TikZ 制作这样的节点?

非常感谢任何关于如何以一种易于编辑和重新格式化的方式创建像这样的繁忙流程图的建议!

编辑

我已开始实施评论中的建议。我从图形的左侧部分开始,如下所示:

\usepackage[utf8]{inputenc}
\usepackage{tikz}
\newcommand\acr[1]{#1}

\usetikzlibrary{fit,positioning,calc}
\begin{document}
\tikzset{anacat/.style={anchor=north west,minimum height=1.5em,x=.3cm,y=.3cm,every node/.style={scale=0.4}}}
\tikzset{bin/.style={draw=black,anchor=west,text width=3cm}}
  \begin{tikzpicture}[x=1cm,y=2cm]
  \begin{scope}[at={(0,0)},local bounding box=Hyy,anacat]
    \node[rotate=90,anchor=north,align=center] at (-1,3) {$H\to\gamma\gamma$};
    \node[bin] at (0,0) {low $p_{\textrm{T}t}$};
    \node[bin] at (0,1) {high $p_{\textrm{T}t}$};
    \node[bin] at (0,2) {\acr{VBF} loose (\acr{MVA})};
    \node[bin] at (0,3) {\acr{VBF} tight (\acr{MVA})};
    \node[bin] at (0,4) {\acr{VH} leptonic};
    \node[bin] at (0,5) {$VH$ leptonic};
    \node[bin] at (0,6) {$t\bar{t}H$ leptonic};  
  \end{scope}
  \node[draw,dotted,fit=(Hyy)] {};
  \begin{scope}[at={($(Hyy.south)$)},local bounding box=HZZ,anacat]
    \node[rotate=90,anchor=north,align=center] at (-1,2) {$H\to ZZ$};
    \node[bin] at (0,0) {ggF $n_{j}=0$};
    \node[bin] at (0,1) {ggF $n_{j}=1$};
    \node[bin] at (0,2) {\acr{VBF} leptonic};
    \node[bin] at (0,3) {\acr{VH} leptonic};
    \node[bin] at (0,4) {\acr{VH} hadronic};
  \end{scope}
  \node[draw,dotted,fit=(HZZ)] {};
  \begin{scope}[at={($(HZZ.south)$)},local bounding box=HWW,anacat]
    \node[rotate=90,anchor=north,align=center] at (-1,2.5) {$H\to WW$};
    \node[bin] at (0,0) {ggF $n_{j}=0$};
    \node[bin] at (0,1) {ggF $n_{j}=1$};
    \node[bin] at (0,2) {ggF $n_{j}\geq 2$};
    \node[bin] at (0,3) {\acr{VBF} $n_{j}\geq 2$};
    \node[bin] at (0,4) {\acr{WH}};
    \node[bin] at (0,5) {\acr{ZH}};
  \end{scope}
  \node[draw,dotted,fit=(HWW)] {};
  \begin{scope}[at={($(HWW.south)$)},local bounding box=Hbb,anacat]
    \node[rotate=90,anchor=north,align=center] at (-1,2) {$H\to b\bar{b}$};
    \node[bin] at (0,1) {\acr{MVA} low $p_{\textrm{T}^V}$};
    \node[bin] at (0,2) {\acr{MVA} low $p_{\textrm{T}^V}$};
    \node[bin] at (0,3) {$\cdots$};
  \end{scope}
  \node[draw,dotted,fit=(Hbb)] {};
  \begin{scope}[at={($(Hbb.south)$)},local bounding box=Htt,anacat]
    \node[rotate=90,anchor=north,align=center] at (-1,1) {$H\to \tau\bar{\tau}$};
    \node[bin] at (0,1) {$\cdots$};
  \end{scope}
  \node[draw,dotted,fit=(Htt)] {};
\end{tikzpicture}

\end{document}

我正在尝试使用at=...语法来促进范围的相对定位,但它似乎没有按照我预期的方式工作。它目前看起来像这样:

左侧部分破损

相对定位和包之间有没有什么不明显的相互作用fit

答案1

pic我为多色节点创建了几个:

  1. twocolors分别有 4 个参数{first color/second color/proportion of the node colored with the first color/node text}
  2. threecolors分别有 6 个参数{first color/second color/third color/proportion of the node colored with the first color/proportion of the node colored with the second color/node text}

此外,我已经使用了一些tikz matrix来缓解节点定位。

以下是(不仅仅是)一个起点,如果您在完成时遇到困难,请告诉我。

我不知道节点文本应该是什么样子,因此我不太关心这些。

\acr我不清楚该宏(在您的 MWE 中)的用途,目前它没有任何作用!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\newcommand{\acr}[1]{#1}% <--- what is this used for? 
\usetikzlibrary{fit,positioning,calc,matrix}
\usetikzlibrary{shapes,arrows.meta}

\begin{document}
    \tikzset{%
        bin/.style={draw=black, text width=3cm, thick, thick,text height=2ex,text depth=.5ex},
        dotbin/.style={draw=black, text width=3cm, thick},
        colbin/.style={text width=3cm, thick,text height=2ex,text depth=.5ex},
        littlebin/.style={draw=black, text width=2cm, thick},
        bigbin/.style={thick, minimum height=2.5cm, minimum width=1cm},
        graynode/.style={draw=gray, very thick, text width=1.5cm, minimum height=1.7cm,font=\large},    
        myarrow/.style={very thick, -latex},    
        pics/twocolors/.style args={#1/#2/#3/#4}{code={%          
                \node[bin, path picture={%
                    \fill[#1] (a.south west) rectangle ($(a.north west)!#3!(a.north east)$);
                    \fill[#2] ($(a.north west)!#3!(a.north east)$) rectangle (a.south east);
                }] (a) {#4};  
        }},
        pics/threecolors/.style args={#1/#2/#3/#4/#5/#6}{code={%          
                \node[bin, path picture={%
                    \fill[#1] (b.south west) rectangle ($(b.north west)!#4!(b.north east)$);
                    \fill[#2] ($(b.south west)!#4!(b.south east)$) rectangle ($(b.north west)!#5!(b.north east)$) ;
                    \fill[#3] ($(b.north west)!#5!(b.north east)$) rectangle (b.south east);
                }] (b) {#6};
        }},
    }
    \resizebox{\textwidth}{!}{% 
        \begin{tikzpicture}
        \matrix[row sep = 10pt] (M1) {%
            % h gamma gamma
            \pic {twocolors={blue/cyan/.75/low $p_{\textrm{T}t}$}}; \\
            \pic {threecolors={blue/cyan/orange/.10/.90/high $p_{\textrm{T}t}$}}; \\
            \pic {twocolors={orange/cyan/.60/\acr{VBF} loose (\acr{MVA})}}; \\
            \node[bin, fill=green]  {\acr{VH} leptonic};\\
            \pic {twocolors={purple/green/.80/$t\bar{t}H$ leptonic}}; \\
            \node[dotbin] {\dots};\\
        };
        \node[left =10pt of M1] (D1) {\rotatebox{90}{$H\to\gamma\gamma$}};
        % h zz
        \matrix[row sep = 4pt, below=10pt of M1.south east, anchor=north east] (M2) {%
            \node[littlebin, fill=blue]  {\dots};\\
            \node[littlebin, fill=blue]  {\dots};\\
            \node[littlebin, fill=orange]  {\dots};\\
        };
        \node[left =10pt of M2] {$H\to ZZ$};
        % h ww
        \matrix[row sep = 10pt,below=10pt of M2.south east, anchor=north east] (M3) {%
            \pic {twocolors={blue/cyan/.80/$=0$jet}}; \\
            \pic {twocolors={blue/cyan/.20/$=1$jet}}; \\
            \pic {twocolors={orange/cyan/.70/$\geq2$jet VBF cuts}}; \\
            \node[dotbin] {\dots};\\
        };
        \node[left =10pt of M3] (D3) {\rotatebox{90}{$H\to WW$}};
        % h bb
        \matrix[row sep = 10pt,below=10pt of M3] (M4) {%
            \node[bin, fill=green]  {MVA low $p_{T}V$};\\
            \node[bin, fill=green]  {MVA high $p_{T}V$};\\
            \node[dotbin] {\dots};\\
        };
        \node[left =10pt of M4] (D4) {\rotatebox{90}{$H\to b\bar{b}$}};
        % h tt
        \matrix[row sep = 4pt, below=10pt of M4, xshift=.5cm] (M5) {%
            \node[littlebin, fill=cyan]  {\dots};\\
            \node[littlebin, fill=orange]  {\dots};\\
            \node[littlebin, fill=green]  {\dots};\\
        };
        \node[left =10pt of M5] (D5) {$H\to \tau\tau$};
        \node[fit=(D1)(M1)(M5)] (firstblock) {};
        \node[fit=(D1)(M1)(M5), draw=gray, very thick] {};
        \foreach \n/\m in {1/2,2/3,3/4,4/5}{%
            \coordinate (M\n-M\m) at ($(M\n.south)!.5!(M\m.north)$);
            \draw[gray, dashed]  ($(firstblock.north east)!(M\n-M\m)!(firstblock.north east)$) -- (M\n-M\m) -- ($(firstblock.north west)!(M\n-M\m)!(firstblock.north west)$);
        } 
%
        \matrix[row sep =50pt, right=50pt of firstblock, anchor=center] (MA) {%
            \node[draw=blue, fill=cyan, bigbin] (MA-1) {\rotatebox{90}{\large $\sigma (ggF)$}};\\
            \node[draw=red, fill=orange, bigbin] (MA-2) {\rotatebox{90}{\large $\sigma (VBF)$}};\\
            \node[draw=olive, fill=green, bigbin] (MA-3) {\rotatebox{90}{\large $\sigma (VH)$}};\\
        };
        \matrix[row sep =20pt, right=30pt of MA-1] {%
            \node[draw=blue, fill=blue, colbin] (MB-1) {$=0-jet$};\\
            \node[draw=blue, fill=cyan, colbin] (MB-2) {$\geq 1$-jet};\\
            \node[draw=blue, fill=cyan, colbin] (MB-3) {$\geq 2$-jet VBF cuts};\\
        };
        \matrix[row sep =20pt, right=30pt of MA-2] {%
            \node[draw=red, fill=orange, colbin] (MC-1) {Rest};\\
            \node[draw=red, fill=orange, colbin] (MC-2) {$\geq 2$-jet VBF cuts};\\
            \node[draw=red, fill=orange, colbin] (MC-3) {high$-q^{2}$ BSM};\\
        };
        \matrix[row sep =20pt, right=30pt of MA-3] {%
            \node[draw=olive, fill=green, colbin] (MD-1) {low $p_{T}^{V}$};\\
            \node[draw=olive, fill=green, colbin] (MD-2) {high $p_{T}^{V}$};\\
            \node[draw=olive, fill=green, colbin] (MD-3) {very high $p_{T}^{V}$};\\
        };
        \node[above=38pt of MA.north west, anchor=south west,text height=3.5ex,text depth=.5ex] (topnode) {ratios of $\quad\Gamma_{\gamma\gamma}\quad \Gamma_{zz}\quad\Gamma_{ww}\quad\Gamma_{b\bar{b}}\quad\Gamma_{\tau\tau}\quad (\Gamma_{z_{\gamma}}\quad \Gamma_{\mu\mu})$};
        \matrix[row sep =4pt, right=30pt of MB-2] (MBB) {%
            \node[draw=blue, fill=cyan, littlebin] (MBB-1) {\dots};\\
            \node[draw=blue, fill=cyan, littlebin] (MBB-2) {\dots};\\
            \node[draw=blue, fill=cyan, littlebin] (MBB-3) {\dots};\\
        };
        \matrix[row sep =4pt, right=30pt of MB-3] {%
            \node[draw=blue, fill=cyan, littlebin] (MBC-1) {\dots};\\
            \node[draw=blue, fill=cyan, littlebin] (MBC-2) {\dots};\\
        };
        \matrix[column sep=36pt, below=40pt of MA.south west, anchor=north west,ampersand replacement=\&] (MD) {%
            \node[draw=blue, fill=purple, text width=1.2cm] {$\sigma(ttH)$}; \&
            \node {}; \&
            \node[draw=orange, fill=yellow, text width=1.2cm] {$\sigma(b\bar{b}H)$}; \&
            \node[draw=orange, fill=yellow, text width=1.2cm] {$\sigma(tH)$}; \\
        };
        \node[fit=(topnode)(MA)(MD)(MBB), draw=gray, very thick] (secondblock) {};
        \matrix[row sep=40pt, right=20pt of secondblock] (MR) {%
            \node[graynode] (MR-1) {$\mu_{i},k_{i}$}; \\
            \node[graynode] (MR-2) {$g_{k}$}; \\
            \node[graynode] (MR-3) {EFT\\coeff}; \\
            \node[graynode] (MR-4) {specific BSM}; \\[-14pt]
            \node[gray,text width=1.5cm, align=center] {\scalebox{3}{$\vdots$}}; \\
    };
    \draw[myarrow,gray] (firstblock) -- (secondblock);
    \foreach \n in {1,2,...,4}{%
        \draw[myarrow,gray] ($(secondblock.north east)!(MR-\n.west)!(secondblock.south east)$) -- (MR-\n.west);
    }
    \coordinate (top-top) at ($(topnode)!.5!(MB-1.north)$);
    \draw[gray, dashed]  ($(secondblock.north east)!(top-top)!(secondblock.north east)$) -- (top-top) -- ($(secondblock.north west)!(top-top)!(secondblock.north west)$);
    \draw[myarrow,blue] (MA-1) -- (MB-2);
    \draw[myarrow,blue] ($(MA-1.east)!.5!(MB-2.west)$) |- (MB-1);
    \draw[myarrow,blue] ($(MA-1.east)!.5!(MB-2.west)$) |- (MB-3);
    \draw[myarrow,blue] (MB-2) -- (MBB-2);
    \draw[myarrow,blue] ($(MB-2.east)!.5!(MBB-2.west)$) |- (MBB-1);
    \draw[myarrow,blue] ($(MB-2.east)!.5!(MBB-2.west)$) |- (MBB-3);
    \draw[myarrow,red] (MA-2) -- (MC-2);
    \draw[myarrow,red] ($(MA-2.east)!.5!(MC-2.west)$) |- (MC-1);
    \draw[myarrow,red] ($(MA-2.east)!.5!(MC-2.west)$) |- (MC-3);
    \draw[myarrow,olive] (MA-3) -- (MD-2);
    \draw[myarrow,olive] ($(MA-3.east)!.5!(MD-2.west)$) |- (MD-1);
    \draw[myarrow,olive] ($(MA-3.east)!.5!(MD-2.west)$) |- (MD-3);
    \coordinate (middle2little) at ($(MBC-1.west)!.5!(MBC-2.west)$);
    \coordinate (middlelittleless) at ($(MB-3.east)!.5!(middle2little)$);
    \draw[myarrow,blue] (MB-3.east) -- (middlelittleless) |- (MBC-1.west);
    \draw[myarrow,blue] (MB-3.east) -- (middlelittleless) |- (MBC-2.west);
    \end{tikzpicture}
    }
\end{document}

在此处输入图片描述

相关内容