如何在 tikz 中绘制连接的文本节点图?

如何在 tikz 中绘制连接的文本节点图?

我对 tikz 包非常陌生。有人能帮我在 tikz 包中写图表吗?

\begin{figure*}
\centering
\resizebox{\textwidth}{!}{
  \begin{tikzpicture}[
        textnode/.style={
            draw,
            rectangle split,
            rectangle split horizontal,
            rectangle split parts=2,
        }
    ]
    \path (-11, 0) node (a) {\includegraphics[width=2cm,height=2cm,keepaspectratio]{puppy}}
          (-8.5, 0) node (b) {\includegraphics[width=2cm,height=2cm,keepaspectratio]{puppy}}
          (-5.5,1) node[textnode] () {A \nodepart{two} B}
          (-5.5,0) node[textnode] (c) {A \nodepart{two} B}
          (-5.5,-1) node[textnode] () {A \nodepart{two} B}
          (-3,0) node[textnode] (d) {A \nodepart{two} B}
          (-1.5,1) node[textnode] () {A \nodepart{two} B}
          (-1.5,0) node[textnode] (e) {A \nodepart{two} B}
          (-1.5,-1) node[textnode] () {A \nodepart{two} B};

    \draw[-stealth,shorten >=1pt,line width=0.5mm] (a) -- (b);
    \draw[-stealth,shorten >=1pt,line width=0.5mm] (b) -- (c);
    \draw[-stealth,shorten >=1pt,line width=0.5mm] (c) -- (d);
    \draw[-stealth,shorten >=1pt,line width=0.5mm] (d) -- (e);


\end{tikzpicture}
 }
\end{figure*}

我得到了这幅图像。在此处输入图片描述

我想要这样的东西。在此处输入图片描述

答案1

使用矩阵(节点矩阵)和定位 tikz 库的选项。

结果:

在此处输入图片描述

梅威瑟:

\documentclass[tikz,border=14pt]{standalone}
\usepackage{tikz} 
\usepackage{duckuments}
\usetikzlibrary{matrix,arrows.meta, positioning,fit,shapes}

\begin{document}
    \begin{tikzpicture}[
        %Environment config
        >={Stealth[inset=0pt,length=6pt]},
        font=\sffamily,
        blue, % It draws all blue
        thick,
        %Environment Styles
        MyMatrix/.style={
            matrix of nodes,
            line width=0.75pt,
            column sep=-0.5pt,
            row sep=-0.5pt,
            text height=9pt,
            text width =12pt,
            text depth =3pt,
            align=center,
            nodes={draw},
            nodes in empty cells
        }
    ]
    % Start Drawing the thing
    \node(Img-1) at (0,0){
        \includegraphics[
            width=2cm,
            height=2cm,
            keepaspectratio
        ]{example-image-a}
    };
    \node[right=0.5 of Img-1](Img-2){
        \includegraphics[
            width=2cm,
            height=2cm,
            keepaspectratio
        ]{example-image-b}
    };
    \matrix[
        MyMatrix,
        right=0.5 of Img-2,
        column 1/.style={nodes={draw=none}},
        row 1/.style={nodes={draw=none}},
        row 5/.style={nodes={draw=none}}
    ](M1){%Matrix contents
        & A&B&C\\
    1   & & & \\
    2   & & & \\
    3   & & & \\
    \vdots&&\vdots&\\
    N   & & & \\
    };

    \matrix[
        MyMatrix,
        right=1cm of M1,
    ](M2){%Matrix contents
        A&B\\
    };

    \matrix[
        MyMatrix,
        right=0.5 of M2,
        column 1/.style={nodes={draw=none}},
        row 1/.style={nodes={draw=none}},
        row 5/.style={nodes={draw=none}}
    ](M3){%Matrix contents
        & A\\
    1   & \\
    2   & \\
    3   & \\
    \vdots &\vdots\\
    N   & \\
    };

    %Draw details:
    \draw[->] (Img-1)--(Img-2);
    \draw[->] (Img-2)--(M1);
    \draw[->] (M1)--(M2);
    \draw[->] (M2)--(M3);
    \end{tikzpicture}
\end{document}

相关内容