如何使用 tikz 排列三个图形?

如何使用 tikz 排列三个图形?

我想要制作如下的图形:

在此处输入图片描述

我当前的工作代码如下:

\documentclass{standalone}

\usepackage{tikz,tikz-cd,pgf,makecell,smartdiagram,lmodern,ragged2e,array,caption,graphicx,booktabs,tabularx,subfig,xcolor}

\usetikzlibrary{positioning}

\begin{document}
    
    \begin{tikzpicture}
        \node (IMG) {
            \includegraphics[width=6cm]{figures/EEG}
        };
        \node[below = 1cm of IMG] (LBL) {
            $
            \left(\begin{array}{cccc}
                a_{11} & a_{12} & \cdots & a_{1n}   \\
                a_{21} & a_{22} & \cdots & a_{2n}   \\
                \vdots & \vdots & \ddots & \vdots   \\
                a_{n1} & a_{n2} & \cdots & a_{nn}
            \end{array}\right)
            $
        };
        \node[right = 2cm of IMG] (MTRX) {
            \centering
            \resizebox{4cm}{4cm}{% Resize table to fit within \linewidth horizontally
                \begin{tabular}{*{4}{c}}
                    \toprule
                    \textbf{Sensor} & $\mathbf{X}$ & $\mathbf{Y}$ & \textbf{APD} \\
                    \midrule
                    $F_{pz}$    & $x_{21}$  & $y_{21}$  & $z_{21}$  \\
                    $F_{p1}$    & $x_{19}$  & $y_{19}$  & $z_{19}$  \\
                    $F_{p2}$    & $x_{20}$  & $y_{20}$  & $z_{20}$  \\
                    $F_3$       & $x_{15}$  & $y_{15}$  & $z_{15}$  \\
                    $F_4$       & $x_{16}$  & $y_{16}$  & $z_{16}$  \\
                    $C_3$       & $x_9$     & $y_9$     & $z_9$     \\
                    $C_4$       & $x_{10}$  & $y_{10}$  & $z_{10}$  \\
                    $P_3$       & $x_6$     & $y_6$     & $z_6$     \\
                    $P_4$       & $x_7$     & $y_7$     & $z_7$     \\
                    $O_1$       & $x_2$     & $y_2$     & $z_2$     \\
                    $O_2$       & $x_3$     & $y_3$     & $z_3$     \\
                    $F_7$       & $x_{17}$  & $y_{17}$  & $z_{17}$  \\
                    $F_8$       & $x_{18}$  & $y_{18}$  & $z_{18}$  \\
                    $T_3$       & $x_{11}$  & $y_{11}$  & $z_{11}$  \\
                    $T_4$       & $x_{12}$  & $y_{12}$  & $z_{12}$  \\
                    $T_5$       & $x_4$     & $y_4$     & $z_4$     \\
                    $T_6$       & $x_5$     & $y_5$     & $z_5$     \\
                    $F_z$       & $x_{14}$  & $y_{14}$  & $z_{14}$  \\
                    $C_z$       & $x_{13}$  & $y_{13}$  & $z_{13}$  \\
                    $P_z$       & $x_8$     & $y_8$     & $z_8$     \\
                    $O_z$       & $x_1$     & $y_1$     & $z_1$     \\
                    \bottomrule
                \end{tabular}}
        };
        \draw[line width=2pt,->] (IMG) -- (MTRX);
    \end{tikzpicture}
    
\end{document}

生成以下内容:

在此处输入图片描述

该怎么办?请帮忙。

答案1

在此处输入图片描述

\documentclass{standalone}
\usepackage[demo]{graphicx}
\usepackage{tikz,tikz-cd,pgf,makecell,smartdiagram,lmodern,ragged2e,array,caption,graphicx,booktabs,tabularx,subfig,xcolor,}

\usetikzlibrary{positioning}

\begin{document}
    
    \begin{tikzpicture}
        \node (IMG) {
            \includegraphics[width=6cm]{figures/EEG}
        };
        \node[below = 1cm of IMG] (LBL) {
            $
            \left(\begin{array}{cccc}
                a_{11} & a_{12} & \cdots & a_{1n}   \\
                a_{21} & a_{22} & \cdots & a_{2n}   \\
                \vdots & \vdots & \ddots & \vdots   \\
                a_{n1} & a_{n2} & \cdots & a_{nn}
            \end{array}\right)
            $
        };
        \node[right = 2cm of IMG, yshift=-2cm] (MTRX) {
            \centering
            \resizebox{4cm}{4cm}{% Resize table to fit within \linewidth horizontally
                \begin{tabular}{*{4}{c}}
                    \toprule
                    \textbf{Sensor} & $\mathbf{X}$ & $\mathbf{Y}$ & \textbf{APD} \\
                    \midrule
                    $F_{pz}$    & $x_{21}$  & $y_{21}$  & $z_{21}$  \\
                    $F_{p1}$    & $x_{19}$  & $y_{19}$  & $z_{19}$  \\
                    $F_{p2}$    & $x_{20}$  & $y_{20}$  & $z_{20}$  \\
                    $F_3$       & $x_{15}$  & $y_{15}$  & $z_{15}$  \\
                    $F_4$       & $x_{16}$  & $y_{16}$  & $z_{16}$  \\
                    $C_3$       & $x_9$     & $y_9$     & $z_9$     \\
                    $C_4$       & $x_{10}$  & $y_{10}$  & $z_{10}$  \\
                    $P_3$       & $x_6$     & $y_6$     & $z_6$     \\
                    $P_4$       & $x_7$     & $y_7$     & $z_7$     \\
                    $O_1$       & $x_2$     & $y_2$     & $z_2$     \\
                    $O_2$       & $x_3$     & $y_3$     & $z_3$     \\
                    $F_7$       & $x_{17}$  & $y_{17}$  & $z_{17}$  \\
                    $F_8$       & $x_{18}$  & $y_{18}$  & $z_{18}$  \\
                    $T_3$       & $x_{11}$  & $y_{11}$  & $z_{11}$  \\
                    $T_4$       & $x_{12}$  & $y_{12}$  & $z_{12}$  \\
                    $T_5$       & $x_4$     & $y_4$     & $z_4$     \\
                    $T_6$       & $x_5$     & $y_5$     & $z_5$     \\
                    $F_z$       & $x_{14}$  & $y_{14}$  & $z_{14}$  \\
                    $C_z$       & $x_{13}$  & $y_{13}$  & $z_{13}$  \\
                    $P_z$       & $x_8$     & $y_8$     & $z_8$     \\
                    $O_z$       & $x_1$     & $y_1$     & $z_1$     \\
                    \bottomrule
                \end{tabular}}
        };
        \draw[line width=2pt,->] (IMG.east) -- ++(2,0);
\draw[line width=2pt,->] ($(MTRX.west)+(0,-2)$) -- ++(-2,0);
  
  \end{tikzpicture}
    
\end{document}

答案2

此版本将顶部和底部对齐。

\documentclass{standalone}
\usepackage[demo]{graphicx}
\usepackage{tikz,tikz-cd,pgf,makecell,smartdiagram,lmodern,ragged2e,array,caption,graphicx,booktabs,tabularx,subfig,xcolor,}

\usetikzlibrary{calc}

\begin{document}
    
    \begin{tikzpicture}
    \node (MTRX) {
            \resizebox{4cm}{4cm}{% Resize table to fit within \linewidth horizontally
                \begin{tabular}{*{4}{c}}
                    \toprule
                    \textbf{Sensor} & $\mathbf{X}$ & $\mathbf{Y}$ & \textbf{APD} \\
                    \midrule
                    $F_{pz}$    & $x_{21}$  & $y_{21}$  & $z_{21}$  \\
                    $F_{p1}$    & $x_{19}$  & $y_{19}$  & $z_{19}$  \\
                    $F_{p2}$    & $x_{20}$  & $y_{20}$  & $z_{20}$  \\
                    $F_3$       & $x_{15}$  & $y_{15}$  & $z_{15}$  \\
                    $F_4$       & $x_{16}$  & $y_{16}$  & $z_{16}$  \\
                    $C_3$       & $x_9$     & $y_9$     & $z_9$     \\
                    $C_4$       & $x_{10}$  & $y_{10}$  & $z_{10}$  \\
                    $P_3$       & $x_6$     & $y_6$     & $z_6$     \\
                    $P_4$       & $x_7$     & $y_7$     & $z_7$     \\
                    $O_1$       & $x_2$     & $y_2$     & $z_2$     \\
                    $O_2$       & $x_3$     & $y_3$     & $z_3$     \\
                    $F_7$       & $x_{17}$  & $y_{17}$  & $z_{17}$  \\
                    $F_8$       & $x_{18}$  & $y_{18}$  & $z_{18}$  \\
                    $T_3$       & $x_{11}$  & $y_{11}$  & $z_{11}$  \\
                    $T_4$       & $x_{12}$  & $y_{12}$  & $z_{12}$  \\
                    $T_5$       & $x_4$     & $y_4$     & $z_4$     \\
                    $T_6$       & $x_5$     & $y_5$     & $z_5$     \\
                    $F_z$       & $x_{14}$  & $y_{14}$  & $z_{14}$  \\
                    $C_z$       & $x_{13}$  & $y_{13}$  & $z_{13}$  \\
                    $P_z$       & $x_8$     & $y_8$     & $z_8$     \\
                    $O_z$       & $x_1$     & $y_1$     & $z_1$     \\
                    \bottomrule
                \end{tabular}}
        };
        \node[below left] at ($(MTRX.north west) + (-2,0)$) (IMG) {
            \includegraphics[width=6cm]{figures/EEG}
        };
        \draw[line width=2pt,->] (IMG.east) -- (IMG -| MTRX.west);
        
        \node[above left] at ($(MTRX.south west) + (-2,0)$) (LBL) {
            $
            \left(\begin{array}{cccc}
                a_{11} & a_{12} & \cdots & a_{1n}   \\
                a_{21} & a_{22} & \cdots & a_{2n}   \\
                \vdots & \vdots & \ddots & \vdots   \\
                a_{n1} & a_{n2} & \cdots & a_{nn}
            \end{array}\right)
            $
        };
        \draw[line width=2pt,<-] (LBL.east) -- (LBL -| MTRX.west);
  
  \end{tikzpicture}
    
\end{document}

演示

相关内容