Agregar títulos para filas y columnas en un subflotante

Agregar títulos para filas y columnas en un subflotante

Tengo estos subflotadores de 6x3 y quiero agregar títulos verticales a cada fila y títulos horizontales a cada columna. Si alguien pudiera indicarme cómo se puede hacer esto. También quiero encajar esta figura en una página.

Esta es mi figura:

\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}

Respuesta1

Dado que \captionof usa \par y \vskip, no puede usarlo en forma tabular. Es más fácil simplemente escribir su propia macro de subtítulos, siempre y cuando no desee que todos estos subflotantes aparezcan en la lista de figuras.

\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}

subtítulos tabuales


Sí, es posible implementar esto sin utilizar una tabla.

\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}

subflotante con nombres de columnas y filas


Mientras preparaba esta demostración de \hfil descubrí que las cosas no son tan simples como pensaba. Específicamente, \\ y \newline parecen agregar algo de espacio adicional a la derecha, en lugar de solo un \hfil. Sin embargo, después de \centrar, \\ pierde el espacio extra (pero no \newline).

Lo último que debe recordar es que dado que todos los \hfils en una línea se expanden al mismo tamaño, si el material entre los \hfils no es del mismo tamaño, entonces no estarán alineados con precisión.

\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}

información relacionada