如何在 tikz 中重叠文本框?

如何在 tikz 中重叠文本框?

我想在 latex(tikz 包)中绘制以下流程图。有人可以帮我完成这项工作吗?在此处输入图片描述

答案1

绘制此类事物的方法有很多种,这里是其中一种。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,positioning,fit}
\begin{document}
\begin{tikzpicture}[data/.style={minimum height=1cm,minimum width=3cm,draw},
font=\sffamily,
% cf https://tex.stackexchange.com/a/175803/121799
apply data style to row/.style={row #1/.append style={nodes={data}}}]
 \matrix (mat) [matrix of nodes,column sep=0.2cm,row sep=2mm,
 apply data style to row/.list={2,3,5,6}
 ]{
 Load datasets & \hspace*{1cm} & Load datasets \\
 Data 1 & & Data 1 \\
 Data 2 & & Data 2 \\[5em]
  & & Load datasets\\
  & & Data 1 \\
  & & Data 2 \\
 };
 \foreach \X [count=\Z] in {(mat-1-1)(mat-3-1),(mat-1-3)(mat-3-3),(mat-4-3)(mat-6-3)}
 {\node[fit=\X,draw,inner ysep=6mm,yshift=-2.5mm,inner xsep=2mm] (F-\Z) {};
  \node[fill=white,draw] (L-\Z) at (F-\Z.south) {Result=Tuple};}
 \draw[-latex,blue] (F-1) -- (F-2);
 \draw[-latex,blue] (L-2) -- (F-3);
\end{tikzpicture}
\end{document}

在此处输入图片描述

至于您的评论...

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[data/.style={minimum height=1cm,minimum width=4cm,draw},
font=\sffamily,
% cf https://tex.stackexchange.com/a/175803/121799
datamat/.style={matrix of nodes,column sep=0.2cm,row sep=2mm,
anchor=north,inner sep=3mm,
nodes={data},row 1/.append style={nodes={draw=none}},draw,
label={[anchor=center,draw,fill=white,name=label]below:#1}}]
\matrix (mat1) [datamat=Tuple]{
 Load datasets \\
 Data 1 \\
 Data 2 \\[1em]
 \\
 };
\matrix (mat2) [datamat=Tuple2,below right=0cm and 2cm of mat1.north east]{
 Load datasets \\
 Data 1 \\
 Data 2 \\
 Data 3 \\[1em]
 \\
 };
\matrix (mat3) [datamat=Tuple3,below=1cm of mat2]{
 Load datasets \\
 Data 1 \\
 Data 2 \\
 Data 3 \\
 Data 4 \\[1em]
 \\
 };
 \draw[-latex,blue,thick] (mat1) -- (mat1-|mat2.west);
 \draw[-latex,blue,thick] ([xshift=5mm]mat2.south west) -- ([xshift=5mm]mat3.north west);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容