如何使用 tikz(使用 xelatex)创建一个包含方框的流程图,这些方框中有标题和最多四个要点(中间的红色方框除外)?我已经设法用我微不足道的 tikz 知识制作了一个简单的流程图,如下所示,但我想让方框的背景颜色向底端淡化,并且它们也没有边框(在底端)。我该如何实现这一点?
奖励:我怎样才能让下部过度支撑达到中间盒子的峰值?
\documentclass[oneside,a4paper]{article}
\usepackage{tikz, tikzscale} % to use flowchart + to scale
\usetikzlibrary{shapes.geometric,arrows,calc,positioning,decorations.pathreplacing,bending}
\tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=red!20]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process2} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=orange!30]
\tikzstyle{process3} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{document}
\begin{tikzpicture}[transform shape, node distance=2cm] % mock flow chart
\node (start) [process, align=center] {Title Bla Bla};
\node (pro1) [process, right of=start, align=center, xshift=2cm] {Title Bla Bla};
\node (pro2) [process, right of=pro1, align=center, xshift=2cm] {Title Bla Bla};
\node (pro3) [process2, below of=start, align=center, yshift=-.5cm] {Title Bla Bla};
\node (pro4) [process2, below of=pro1, align=center, yshift=-.5cm] {Title Bla Bla};
\node (pro5) [process2, below of=pro2, yshift=-.5cm] {Title Bla Bla};
\node (main) [startstop, below of=pro4, yshift=-.5cm] {Title Bla Bla};
\node (pro6) [process3, below left=1cm and 1cm of main, align=center] {Title Bla Bla};
\node (pro7) [process3, below of=main, align=center] {Title Bla Bla};
\node (pro8) [process3, below right=1cm and 1cm of main, align=center] {Title Bla Bla};
\node (pro9) [process3, right of=pro8, align=center, xshift=2cm] {Title Bla Bla};
\draw [arrow] (start) -- (pro3);
\draw [arrow] (pro1.south) -- (pro3.north);
\draw [arrow] (pro1.south) -- (pro5.north);
\draw [arrow] (pro2.south) -- (pro5.north);
\draw [arrow] (pro2.south) -- (pro4.north);
\draw[decorate, decoration={brace, mirror, amplitude=10pt, raise=4pt}, yshift=-2cm] (pro3.south west) -- (pro5.south east);
\draw[decorate, decoration={brace, amplitude=10pt, raise=4pt}, yshift=4cm] (pro6.north west) -- (pro9.north east);
\end{tikzpicture}
\end{document}
提前非常感谢您!
答案1
看看吧,以下 MWE 提供了您想要获得的内容:
\documentclass[tikz,
border=3mm,
]{standalone}
\usetikzlibrary{arrows.meta,
decorations.pathreplacing,
calligraphy,%had to be after lib. decorations.pathreplacing
positioning,
shadows
}
\usepackage{enumitem}
\setlist{nosep,leftmargin=*}
\begin{document}
\begin{tikzpicture}[
node distance = 22mm and 11mm,
box/.style = {shape=rectangle, draw, thin,
minimum height=10mm, text width=32mm, align=center,
top color=#1!20, bottom color=#1!80,
anchor=south west
},
BC/.style args = {#1/#2/#3}{% Braces Calligraphic
decorate,
decoration={calligraphic brace, amplitude=6pt,
raise=#1,
#2,% for mirroring of brace
aspect=#3},
very thick,
pen colour={gray}
},
] % mock flow chart
nodes, first row
\node (start) [box=blue] {\parbox{\hsize}{Title Bla Bla,
\begin{itemize}
\item item 1
\item item 2
\item item 3
\end{itemize}}};
\node (pro1) [right=of start.south east,box=blue] {Title Bla Bla,
\begin{itemize}
\item item 1
\item item 2
\end{itemize}};
\node (pro2) [right=of pro1.south east,box=blue] {Title Bla Bla,
\begin{itemize}
\item item 1
\end{itemize}};
% nodes, second row
\node (pro3) [below=of start.south west,box=orange] {Title Bla Bla};
\node (pro4) [right=of pro3.south east,box=orange] {Title Bla Bla};
\node (pro5) [right=of pro4.south east,box=orange] {Title Bla Bla};
% nodes, third row
\node (pro6) [below=of pro4.south west,box=red,rounded corners] {Title Bla Bla};
% nodes, forth row
\node (pro7) [below=of pro3.west |- pro6.south,
box=green] {Title Bla Bla};
\node (pro8) [right=of pro7.south east,box=green] {Title Bla Bla};
\node (pro9) [right=of pro8.south east,box=green] {Title Bla Bla};
\node (pro10) [right=of pro9.south east,box=green] {Title Bla Bla};
% connections
\draw[-Stealth] (start) edge (pro3)
(pro1.south) edge (pro3) (pro1.south) edge (pro5)
(pro2.south) edge (pro4) (pro2.south) edge (pro5);
% braces
\draw[BC=2mm/mirror/0.500] (pro3.south west) -- (pro5.south east);
\draw[BC=2mm/ /0.375] (pro7.north west) -- (pro10.north east);
\end{tikzpicture}
\end{document}