Tikz 图片与 \subcaptionbox 对齐

Tikz 图片与 \subcaptionbox 对齐

当制作多个 tikz 图片(矩阵)时,对齐变得模糊。当我只制作 4 个时,一切正常,但当我创建 6 个时,底部的两个对齐不正确。

有人能帮我调整一下吗?

(在我的真实论文中,地图是 17X17,但这不符合问题)。

Example of Output

    \usepackage[center,small]{caption}
    \setlength{\captionmargin}{36pt}
    \newcommand{\legend}[1]{
        \newlength{\captiontextwidth}
        \setlength{\captiontextwidth}{\textwidth}
        \addtolength{\captiontextwidth}{-2\captionmargin}
        \vspace{0.1mm}
        \hspace{2.7mm}\parbox{\captiontextwidth}{\singlespace \small (#1)}
    }
    \usepackage{tikz}               % Used for gantt
    \usetikzlibrary{matrix}             % used for Markov Maps
    %\usepackage{gantt}             % Gantt charts
    \usepackage{pgf-pie}                % pie charts
    \usepackage{subcaption}
    \usepackage{rotating}
    \begin{document}

\begin{figure}[tb]
    \subcaptionbox{Cluster 1, $\pi_1 = 0.14$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    column 1/.style={nodes={draw=none, minimum width=30mm, text width=28mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    { \&    AC  \&  CH  \&  DP  \&  HP  \&  IA  \&  LB  \&  LP  \&  NL  \&  SC  \&  show\_discount\_reminder    \&  show\_funnel\_campaign  \&  show\_recc  \&  show\_recp  \&  show\_upsell    \&  show\_wijnatlas     \&  WV  \&  XT  \\
    AC  \& |[fill=black!    1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  68  ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  16  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    CH  \& |[fill=black!    1   ]|\& |[fill=black!  7   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  65  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\\
    DP  \& |[fill=black!    4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  75  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
    HP  \& |[fill=black!    2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  42  ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  15  ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\\
    IA  \& |[fill=black!    0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  12  ]|\& |[fill=black!  9   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  35  ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  36  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    LB  \& |[fill=black!    5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  24  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  21  ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  25  ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    LP  \& |[fill=black!    2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  6   ]|\& |[fill=black!  1   ]|\& |[fill=black!  3   ]|\& |[fill=black!  33  ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
    NL  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  30  ]|\& |[fill=black!  50  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\\
    SC  \& |[fill=black!    0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  73  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
    show\_discount  \& |[fill=black!    4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  4   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  52  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\\
    show\_funnel    \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  31  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  60  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
    };
    \end{tikzpicture}
    }
    \subcaptionbox{Cluster 2, $\pi_2 = 0.15$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    %column 1/.style={nodes={draw=none, minimum width=43mm, text width=40mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    { AC    \&  CH  \&  DP  \&  HP  \&  IA  \&  LB  \&  LP  \&  NL  \&  SC  \&  show\_discount\_reminder    \&  show\_funnel\_campaign  \&  show\_recc  \&  show\_recp  \&  show\_upsell    \&  show\_wijnatlas     \&  WV  \&  XT  \\
         |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  44  ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  40  ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  20  ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  28  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\\
         |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  19  ]|\& |[fill=black!  2   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  38  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
         |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  39  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  20  ]|\& |[fill=black!  1   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
         |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  15  ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  2   ]|\& |[fill=black!  30  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  21  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  15  ]|\& |[fill=black!  21  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  29  ]|\& |[fill=black!  1   ]|\& |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  16  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  5   ]|\& |[fill=black!  1   ]|\& |[fill=black!  3   ]|\& |[fill=black!  41  ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  4   ]|\& |[fill=black!  86  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\\
         |[fill=black!  1   ]|\& |[fill=black!  8   ]|\& |[fill=black!  3   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  3   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  54  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  33  ]|\& |[fill=black!  0   ]|\& |[fill=black!  11  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  33  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  59  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  23  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  11  ]|\\
    };
    \end{tikzpicture}
    }
    \subcaptionbox{Cluster 3, $\pi_3 = 0.33$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    %row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    column 1/.style={nodes={draw=none, minimum width=30mm, text width=28mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    { AC    \& |[fill=black!    2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  31  ]|\& |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  53  ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    CH  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  2   ]|\& |[fill=black!  23  ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  38  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  33  ]|\\
    DP  \& |[fill=black!    7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  30  ]|\& |[fill=black!  4   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  15  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  25  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
    HP  \& |[fill=black!    5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  8   ]|\& |[fill=black!  49  ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  24  ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  4   ]|\\
    IA  \& |[fill=black!    2   ]|\& |[fill=black!  2   ]|\& |[fill=black!  19  ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  24  ]|\& |[fill=black!  2   ]|\& |[fill=black!  37  ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    LB  \& |[fill=black!    5   ]|\& |[fill=black!  3   ]|\& |[fill=black!  9   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  38  ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    LP  \& |[fill=black!    9   ]|\& |[fill=black!  0   ]|\& |[fill=black!  11  ]|\& |[fill=black!  5   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  52  ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
    NL  \& |[fill=black!    3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  13  ]|\& |[fill=black!  53  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\\
    SC  \& |[fill=black!    1   ]|\& |[fill=black!  10  ]|\& |[fill=black!  2   ]|\& |[fill=black!  2   ]|\& |[fill=black!  1   ]|\& |[fill=black!  3   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  63  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\\
    show\_discount  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  87  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\\
    show\_funnel    \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  90  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\\
    };
    \end{tikzpicture}
    }
    \subcaptionbox{Cluster 4, $\pi_4 = 0.10$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    %row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    %column 1/.style={nodes={draw=none, minimum width=43mm, text width=40mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    {    |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  40  ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  27  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  18  ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  30  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  36  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  14  ]|\\
         |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  69  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
         |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  48  ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  16  ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  14  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\\
         |[fill=black!  12  ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  0   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  5   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  29  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  20  ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  22  ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  45  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  84  ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  38  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  33  ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  49  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  34  ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  35  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  55  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    };
    \end{tikzpicture}
    }
    \subcaptionbox{Cluster 5, $\pi_5 = 0.20$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    %row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    column 1/.style={nodes={draw=none, minimum width=43mm, text width=40mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    {AC \& |[fill=black!    1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  84  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    CH  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  16  ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  40  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  41  ]|\\
    DP  \& |[fill=black!    2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  14  ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  10  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  56  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
    HP  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  69  ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  15  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\\
    IA  \& |[fill=black!    4   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  37  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  19  ]|\& |[fill=black!  0   ]|\& |[fill=black!  27  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    LB  \& |[fill=black!    4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  37  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  36  ]|\& |[fill=black!  1   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  4   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\\
    LP  \& |[fill=black!    7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  30  ]|\& |[fill=black!  0   ]|\& |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  42  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
    NL  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  7   ]|\& |[fill=black!  83  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    SC  \& |[fill=black!    0   ]|\& |[fill=black!  12  ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  1   ]|\& |[fill=black!  2   ]|\& |[fill=black!  5   ]|\& |[fill=black!  0   ]|\& |[fill=black!  57  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  15  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\\
    show\_discount  \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  14  ]|\& |[fill=black!  0   ]|\& |[fill=black!  86  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    show\_funnel    \& |[fill=black!    0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  7   ]|\& |[fill=black!  0   ]|\& |[fill=black!  89  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
    };
    \end{tikzpicture}
    }
    \subcaptionbox{Cluster 6, $\pi_6 = 0.08$}{
    \begin{tikzpicture}[font=\ttfamily, ampersand replacement=\&]
    \matrix (A) [nodes in empty cells,
    matrix of nodes,
    nodes={draw, minimum size=3mm, inner sep=0pt, outer sep=0pt, anchor=center},
    %row 1/.style={nodes={draw=none, rotate=90, anchor=west, inner xsep=1mm}},
    %column 1/.style={nodes={draw=none, minimum width=43mm, text width=40mm, align=right}},
    column sep=-\pgflinewidth,
    row sep=-\pgflinewidth
    ]
    {    |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  50  ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  4   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  44  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  8   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  14  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  76  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\\
         |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  91  ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  5   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  67  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  2   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  17  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  77  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  22  ]|\& |[fill=black!  21  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  13  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  40  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  3   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  86  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  100 ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  9   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  1   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  6   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  83  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  16  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  16  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  67  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
         |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  26  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  74  ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\& |[fill=black!  0   ]|\\
     };
    \end{tikzpicture}
    }
    \label{TP_sessionS5}
    \caption{Transition probabilities of session data using MMM}
    \end{figure}
    \end{document}

更新:实施建议后

enter image description here

答案1

可能是因为你有

column 1/.style={nodes={draw=none, minimum width=43mm, text width=40mm, align=right}},

在第五个子图中,而在第一和第三个子图中

column 1/.style={nodes={draw=none,minimum width=30mm, text width=28mm, align=right}},

由于第五个子图第一列的节点更宽,其左侧的空白更多,因此看起来它向右移动了。

将所有的minimum width/设置text width为相同的值。如果第一列的内容始终相同,您也可以将这些设置全部删除。

相关内容