Adicione títulos para linhas e colunas em um subfloat

Adicione títulos para linhas e colunas em um subfloat

Eu tenho esses subfloats 6x3 e quero adicionar títulos verticais a cada linha deles e títulos horizontais a cada coluna. Também quero encaixar essa figura em uma página.

Esta é a minha 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}

Responder1

Como \captionof usa \par e \vskip, você não pode usá-lo em uma tabela. É mais fácil escrever sua própria macro de legenda, desde que você não queira que todos esses subflutuantes apareçam na 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}

legendas tabuais


Sim, é possível implementar isso sem usar uma tabela.

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

subfloat com nomes de colunas e linhas


Enquanto preparava esta demonstração do \hfil, descobri que as coisas não são tão simples quanto eu pensava. Especificamente, \\ e \newline parecem adicionar algum espaço adicional à direita, em vez de apenas um \hfil. Após \centering, entretanto, \\ perde o espaço extra (mas não \newline).

A última coisa a lembrar é que, como todos os \hfils em uma linha se expandem para o mesmo tamanho, se o material entre os \hfils não for do mesmo tamanho, eles não estarão alinhados com precisão.

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

informação relacionada