
Ich habe diese 6x3 Subfloats und möchte jeder Zeile davon vertikale Titel und jeder Spalte horizontale Titel hinzufügen. Kann mir jemand bitte sagen, wie das geht? Ich möchte diese Abbildung auch auf eine Seite bringen.
Das ist meine Figur:
\documentclass[12pt]{report}
\begin{figure}
\centering
\subfloat[0.2]{\includegraphics[width=.32\linewidth {a.png}}\label{a}
\subfloat[0.2]{\includegraphics[width=.32\linewidth]{b.png}}\label{b}
\subfloat[0.3]{\includegraphics[width=.32\linewidth]{c.png}}\label{c}\\
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{d.png}}\label{d}
\subfloat[0.4]{\includegraphics[width=.32\linewidth]{e.png}}\label{e}
\subfloat[0.6]{\includegraphics[width=.32\linewidth]{f.png}}\label{f}\\
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{g.png}}\label{g}
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{h.png}}\label{h}
\subfloat[0.7]{\includegraphics[width=.32\linewidth]{i.png}}\label{i}\\
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{j.png}}\label{j}
\subfloat[0.6]{\includegraphics[width=.32\linewidth]{k.png}}\label{k}
\subfloat[0.7]{\includegraphics[width=.32\linewidth]{l.png}}\label{l}\\
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{m.png}}\label{m}
\subfloat[0.6]{\includegraphics[width=.32\linewidth]{n.png}}\label{n}
\subfloat[0.7]{\includegraphics[width=.32\linewidth]{o.png}}\label{o}\\
\subfloat[0.5]{\includegraphics[width=.32\linewidth]{p.png}}\label{p}
\subfloat[0.6]{\includegraphics[width=.32\linewidth]{q.png}}\label{q}
\subfloat[0.7]{\includegraphics[width=.32\linewidth]{r.png}}\label{r}
\caption{results}
\label{figure1}
\end{figure}
Antwort1
Da \captionof \par und \vskip verwendet, können Sie es nicht in einer Tabelle verwenden. Es ist einfacher, einfach Ihr eigenes Beschriftungsmakro zu schreiben, solange Sie nicht möchten, dass all diese Unterfloats in der Abbildungsliste angezeigt werden.
\documentclass{memoir}
\usepackage{mwe}
\newlength{\tempdima}
\newcommand{\rowname}[1]% #1 = text
{\rotatebox{90}{\makebox[\tempdima][c]{\textbf{#1}}}}
\newcounter{subfigure}[figure]
\renewcommand{\thesubfigure}{\alph{subfigure}}
\newcommand{\mycaption}[1]% #1 = caption
{\refstepcounter{subfigure}\textbf{(\thesubfigure) }{\ignorespaces #1}}
\begin{document}
\centering%
\begin{figure}
\settoheight{\tempdima}{\includegraphics[width=.32\linewidth]{example-image-a}}%
\centering\begin{tabular}{@{}c@{ }c@{ }c@{ }c@{}}
&\textbf{Trial A} & \textbf{Trial B} & \textbf{Trial C} \\
\rowname{Exp 1}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.2} & \mycaption{0.2} & \mycaption{0.3}\\
\rowname{Exp 2}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.5} & \mycaption{0.4} & \mycaption{0.6}\\
\rowname{Exp 3}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.5} & \mycaption{0.5} & \mycaption{0.7} \\
\rowname{Exp 4}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.5} & \mycaption{0.6} & \mycaption{0.7} \\
\rowname{Exp 5}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.5} & \mycaption{0.6} & \mycaption{0.7} \\
\rowname{Exp 6}&
\includegraphics[width=.3\linewidth]{example-image-a}&
\includegraphics[width=.3\linewidth]{example-image-b}&
\includegraphics[width=.3\linewidth]{example-image-c}\\[-1ex]
&\mycaption{0.5} & \mycaption{0.6} & \mycaption{0.7} \\
\end{tabular}
\caption{results}%
\label{figure1}
\end{figure}
\end{document}
Ja, es ist möglich, dies ohne Verwendung einer Tabelle umzusetzen.
\documentclass{report}
\usepackage{subfig}
\usepackage{mwe}
\newlength{\tempheight}
\newlength{\tempwidth}
\newcommand{\rowname}[1]% #1 = text
{\rotatebox{90}{\makebox[\tempheight][c]{\textbf{#1}}}}
\newcommand{\columnname}[1]% #1 = text
{\makebox[\tempwidth][c]{\textbf{#1}}}
\begin{document}
\begin{figure}
\setlength{\tempwidth}{.3\linewidth}
\settoheight{\tempheight}{\includegraphics[width=\tempwidth]{example-image-a}}%
\centering
\hspace{\baselineskip}
\columnname{Test A}\hfil
\columnname{Test B}\hfil
\columnname{Test C}\\
\rowname{Exp 1}
\subfloat[0.2]{\includegraphics[width=\tempwidth]{example-image-a}}\label{a}\hfil
\subfloat[0.2]{\includegraphics[width=\tempwidth]{example-image-b}}\label{b}\hfil
\subfloat[0.3]{\includegraphics[width=\tempwidth]{example-image-c}}\label{c}\\
\rowname{Exp 2}
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-a}}\label{d}\hfil
\subfloat[0.4]{\includegraphics[width=\tempwidth]{example-image-b}}\label{e}\hfil
\subfloat[0.6]{\includegraphics[width=\tempwidth]{example-image-c}}\label{f}\\
\rowname{Exp 3}
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-a}}\label{g}\hfil
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-b}}\label{h}\hfil
\subfloat[0.7]{\includegraphics[width=\tempwidth]{example-image-c}}\label{i}\\
\rowname{Exp 4}
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-a}}\label{j}\hfil
\subfloat[0.6]{\includegraphics[width=\tempwidth]{example-image-b}}\label{k}\hfil
\subfloat[0.7]{\includegraphics[width=\tempwidth]{example-image-c}}\label{l}\\
\rowname{Exp 5}
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-a}}\label{m}\hfil
\subfloat[0.6]{\includegraphics[width=\tempwidth]{example-image-b}}\label{n}\hfil
\subfloat[0.7]{\includegraphics[width=\tempwidth]{example-image-c}}\label{o}\\
\rowname{Exp 6}
\subfloat[0.5]{\includegraphics[width=\tempwidth]{example-image-a}}\label{p}\hfil
\subfloat[0.6]{\includegraphics[width=\tempwidth]{example-image-b}}\label{q}\hfil
\subfloat[0.7]{\includegraphics[width=\tempwidth]{example-image-c}}\label{r}
\caption{results}
\label{figure1}
\end{figure}
\end{document}
Während ich diese \hfil-Demo vorbereitete, entdeckte ich, dass die Dinge nicht ganz so einfach sind, wie ich dachte. Insbesondere scheinen \\ und \newline etwas zusätzlichen Platz rechts hinzuzufügen, anstatt nur ein \hfil. Nach \centering verliert \\ jedoch den zusätzlichen Platz (aber nicht \newline).
Als Letztes müssen Sie bedenken, dass alle \hfils in einer Zeile die gleiche Größe annehmen. Wenn also die Elemente zwischen den \hfils nicht die gleiche Größe haben, werden sie nicht genau ausgerichtet.
\documentclass{article}
\begin{document}
\begin{figure}[t]
\rule{\textwidth}{1pt}
\hfil\fbox{centered}\linebreak[4]
\hfil\fbox{skewed}\\
\indent\hfil\fbox{recentered}\\
\hfil\fbox{two}\hfil\fbox{columns}\linebreak[4]
\hfil\fbox{now}\hfil\fbox{three}\hfil\fbox{columns}\linebreak[4]
\centering\fbox{centered}\\
\fbox{skewed}\newline
\fbox{two}\hfil\fbox{columns}\\
\fbox{now}\hfil\fbox{three}\hfil\fbox{columns}\\
\fbox{left}\hfill\fbox{center}\hfill\fbox{right}\\
\leavevmode\rlap{\fbox{left}}\hfill\fbox{center}\hfill\llap{\fbox{right}}\\
\rule{\textwidth}{1pt}
\end{figure}
\end{document}