하위 부동의 행과 열에 대한 제목 추가

하위 부동의 행과 열에 대한 제목 추가

나는 이 6x3 하위 플로트를 가지고 있으며 각 행에 수직 제목을 추가하고 각 열에 수평 제목을 추가하고 싶습니다. 누구든지 이 작업을 수행할 수 있는 방법에 대해 조언해 주시기 바랍니다. 저도 이 그림을 한 페이지에 담고 싶습니다.

이것은 내 수치입니다.

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

답변1

\captionof는 \par과 \vskip을 사용하므로 표 형식에서는 사용할 수 없습니다. 그림 목록에 이러한 모든 하위 플로트가 표시되는 것을 원하지 않는 한 자신만의 캡션 매크로를 작성하는 것이 더 쉽습니다.

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

테이블러 캡션


예, 표 형식을 사용하지 않고도 이를 구현할 수 있습니다.

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

열 및 행 이름이 있는 하위 부동


이 \hfil 데모를 준비하는 동안 나는 일이 생각만큼 간단하지 않다는 것을 발견했습니다. 특히 \\와 \newline은 단지 \hfil이 아닌 오른쪽에 추가 공간을 추가하는 것처럼 보입니다. 그러나 \centering 후에 \\는 추가 공간을 잃습니다(그러나 \newline은 잃습니다).

마지막으로 기억해야 할 점은 한 줄의 모든 \hfils가 동일한 크기로 확장되므로 \hfils 사이의 항목이 동일한 크기가 아니면 정확하게 정렬되지 않는다는 것입니다.

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

관련 정보