如何在流程图中添加表格?

如何在流程图中添加表格?

我需要绘制如下图的流程图,我可以把LaTeX流程图中的表格添加为节点吗?

我的代码:

\tikzstyle{c-rectangle2} = [rectangle, ultra thick, rounded corners, minimum width=2cm, minimum height=1cm,text centered, text width = 4cm, draw=black, fill=white]
\tikzstyle{arrow} = [ultra thick,->,>=stealth]
\begin{figure}[H]
\centering
\begin{tikzpicture}[node distance = 2cm]
    \node (start) [c-rectangle2] {start};
    \node (part) [c-rectangle2, below of=start] {data};
    \node (no) [c-rectangle2,below of=part, xshift=3cm] {A};
    \node (plane) [c-rectangle2,below of=no] {B};
    \node (cylindrical) [c-rectangle2,below of=plane] {C};
    \node (both) [c-rectangle2,below of=cylindrical] {D};
    \node (fixed) [c-rectangle2,below of=both] {E};     
    \draw[arrow] (start) -- (part);
    \draw[arrow] (part) |- (no);
    \draw[arrow] (part)[anchor=north, xshift=-1.5cm] |- (plane);
    \draw[arrow] (part)[anchor=north, xshift=-5cm] |- (cylindrical);
    \draw[arrow] (part)[anchor=north, xshift=-10cm] |- (both);
    \draw[arrow] (part)[anchor=north, xshift=-18cm] |- (fixed);
\end{tikzpicture}
\caption{Illustration of State of the Art}
\label{fig:Illustration of State of the Art}
\end{figure}
\begin{table}[H]
\begin{tabular}{|l|l|l|}
\hline
\rowcolor[HTML]{3531FF} 
 -                                      & {\color[HTML]{FFFFFF} 
 \textbf{Part1}} & {\color[HTML]{FFFFFF} \textbf{Part2}} \\ \hline
 \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
 & 0                                     \\ \hline
 \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
  & 0                                     \\ \hline
 \end{tabular}
 \end{table}

在此处输入图片描述

答案1

欢迎使用 TeX-SE。是的,正如 ferahfeza 指出的那样,你可以。只需将表格添加到节点内容中。请不要使用\tikzstyle

\documentclass{article}
\usepackage{colortbl}
\usepackage{tikz}
\usetikzlibrary{positioning}


\begin{document}
\tikzset{c-rectangle2/.style={rectangle, ultra thick, rounded corners, minimum
width=2cm, minimum height=1cm,text centered, text width = 4cm, draw=black,
fill=white},
arrow/.style={ultra thick,->,>=stealth}}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[node distance = 2cm]
    \node (start) [c-rectangle2] {start};
    \node (part) [c-rectangle2, below of=start] {data};
    \node (no) [c-rectangle2,below of=part, xshift=3cm] {A};
    \node[right=1cm of no] (tabA){\begin{tabular}{|l|l|l|}
    \hline
    \rowcolor[HTML]{3531FF} 
     -                                      & \textcolor[HTML]{FFFFFF} 
     {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
     & 0  \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
      & 0 \\ \hline \end{tabular}};
    \draw[arrow] (no) -- (tabA);
    \node (plane) [c-rectangle2,below of=no] {B};
    \node[right=1cm of plane] (tabB){\begin{tabular}{|l|l|l|}
    \hline
    \rowcolor[HTML]{3531FF} 
     -                                      & \textcolor[HTML]{FFFFFF} 
     {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
     & 0  \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
      & 0 \\ \hline \end{tabular}};
    \draw[arrow] (plane) -- (tabB);
    \node (cylindrical) [c-rectangle2,below of=plane] {C};
    \node[right=1cm of cylindrical] (tabC){\begin{tabular}{|l|l|l|}
    \hline
    \rowcolor[HTML]{3531FF} 
     -                                      & \textcolor[HTML]{FFFFFF} 
     {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
     & 0  \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
      & 0 \\ \hline \end{tabular}};
    \draw[arrow] (cylindrical) -- (tabC);
    \node (both) [c-rectangle2,below of=cylindrical] {D};
    \node[right=1cm of both] (tabD){\begin{tabular}{|l|l|l|}
    \hline
    \rowcolor[HTML]{3531FF} 
     -                                      & \textcolor[HTML]{FFFFFF} 
     {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
     & 0  \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
      & 0 \\ \hline \end{tabular}};
    \draw[arrow] (both) -- (tabD);
    \node (fixed) [c-rectangle2,below of=both] {E}; 
    \node[right=1cm of fixed] (tabE){\begin{tabular}{|l|l|l|}
    \hline
    \rowcolor[HTML]{3531FF} 
     -                                      & \textcolor[HTML]{FFFFFF} 
     {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
     & 0  \\ \hline
     \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
      & 0 \\ \hline \end{tabular}};
    \draw[arrow] (fixed) -- (tabE);
    \draw[arrow] (start) -- (part);
    \draw[arrow] (part) |- (no);
    \draw[arrow] (part)[anchor=north, xshift=-1.5cm] |- (plane);
    \draw[arrow] (part)[anchor=north, xshift=-5cm] |- (cylindrical);
    \draw[arrow] (part)[anchor=north, xshift=-10cm] |- (both);
    \draw[arrow] (part)[anchor=north, xshift=-18cm] |- (fixed);
\end{tikzpicture}
\caption{Illustration of State of the Art}
\label{fig:Illustration of State of the Art}
\end{figure}
\begin{table}[htb]
\begin{tabular}{|l|l|l|}
\hline
\rowcolor[HTML]{3531FF} 
 -                                      & \textcolor[HTML]{FFFFFF} 
 {\textbf{Part1}} & \textcolor[HTML]{FFFFFF}{\textbf{Part2}} \\ \hline
 \cellcolor[HTML]{DAE8FC}\textbf{Part1} & 0                                     
 & 0                                     \\ \hline
 \cellcolor[HTML]{DAE8FC}\textbf{Part2} & 0                                     
  & 0                                     \\ \hline
 \end{tabular}
 \end{table}

\end{document} 

在此处输入图片描述

相关内容