多行不适用于子图

多行不适用于子图

我尝试在由六个子图组成的图形中添加颜色条。在我的 MWE 中,我已将它们替换为字母,以免给您带来额外的麻烦:

% Einstellung der Dokumentklasse für A4 und weitere Optionen
\documentclass[12pt, a4paper, bibliography=totoc, listof=totoc, parskip=half, numbers=noenddot]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[english, ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage{siunitx}
\usepackage{ziffer}
\usepackage{float}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz, tikz-3dplot, pgfplots}
% Zahlen mit Einheiten setzen
\usepackage{siunitx}
\usepackage{tikz, tikz-3dplot, pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{figure}[p]
    \centering
    \begin{tabular}{cccc}
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{A}
        \caption{Zeitschritt 31}
        \label{fig:develops031}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{B}
        \caption{Zeitschritt 51}
        \label{fig:develops051}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{C}
        \caption{Zeitschritt 71}
        \label{fig:develops071}
    \end{subfigure}
    & 
    \multirow{2}{*}{
        \begin{subfigure}[b]{0.25\textwidth}
            \centering          
            \begin{tikzpicture}
                \begin{axis}[
                    hide axis,
                    scale only axis,
                    height=0pt,
                    width=0pt,
                    colormap/hot2,
                    colorbar right,
                    point meta min=300,
                    point meta max=3133,
                    colorbar style={height=8cm}]                            
                    \addplot [draw=none] coordinates {(0,0)};
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}
    }\\ 
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{D}
        \caption{Zeitschritt 91}
        \label{fig:develops091}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{E}
        \caption{Zeitschritt 111}
        \label{fig:develops111}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{F}
        \caption{Zeitschritt 131}
        \label{fig:develops131}
    \end{subfigure}
    &\\
    \end{tabular}
    \caption{Entwicklung der Temperaturen im Längsschnitt}
    \label{fig:referenz_development_section}
\end{figure}
\end{document}

我得到了这个结果: 在此处输入图片描述

问题在于颜色条,它不在应在的位置。它应该横跨两行,但看起来它只在下一行。

我也尝试过将颜色条移到最后一个位置并调用

\multirow{-2}{*}{...

但这会产生相同的结果。

如何存档所需的结果,使颜色条位于“两行”的右侧?

答案1

我使用了\multirow一个高度和深度为零的盒子(通过\raisebox),并添加了baseline=(current bounding box.center)选项tikzpicture

\documentclass[12pt, a4paper, bibliography=totoc, listof=totoc, parskip=half, numbers=noenddot]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[english, ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage{siunitx}
\usepackage{ziffer}
\usepackage{float}
\usepackage{subcaption}
\usepackage{multirow}
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz, tikz-3dplot, pgfplots}
% Zahlen mit Einheiten setzen
\usepackage{siunitx}
\usepackage{tikz, tikz-3dplot, pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{figure}[p]
    \centering
    \begin{tabular}{cccc}
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{A}
        \caption{Zeitschritt 31}
        \label{fig:develops031}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{B}
        \caption{Zeitschritt 51}
        \label{fig:develops051}
    \end{subfigure}~
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{C}
        \caption{Zeitschritt 71}
        \label{fig:develops071}
    \end{subfigure}
    & 
        \raisebox{0pt}[0pt][0pt]{\begin{subfigure}[b]{0.25\textwidth}
            \centering          
            \begin{tikzpicture}[baseline=(current bounding box.center)]
                \begin{axis}[
                    hide axis,
                    scale only axis,
                    height=0pt,
                    width=0pt,
                    colormap/hot2,
                    colorbar right,
                    point meta min=300,
                    point meta max=3133,
                    colorbar style={height=8cm}]                            
                    \addplot [draw=none] coordinates {(0,0)};
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}
    }\\ 
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{D}
        \caption{Zeitschritt 91}
        \label{fig:develops091}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{E}
        \caption{Zeitschritt 111}
        \label{fig:develops111}
    \end{subfigure}
    &
    \begin{subfigure}[b]{0.25\textwidth}
        \centering
        \resizebox{3.5cm}{!}{F}
        \caption{Zeitschritt 131}
        \label{fig:develops131}
    \end{subfigure}
    &\\
    \end{tabular}
    \caption{Entwicklung der Temperaturen im Längsschnitt}
    \label{fig:referenz_development_section}
\end{figure}
\end{document}

在此处输入图片描述

相关内容