[Tex/LaTex] How to make a figure consisting of a table of subfigures and headings

graphicstables

I've got 3×3 images that I'd like to arrange in a table with row and column headings. All images have the same dimensions. I still want the caption to read "Figure 1.1" and not "Table 1.1".

One way I've come up with would be to make a table with \includegraphics in most cells, and then figure out how to change the caption to "Figure". Another way would be to arrange the pictures in a TikZ matrix.

desired outcome

What would be the best solution?

Best Answer

While a figure environment is intended for images and graphics, it is not limited to that, so there is nothing wrong with having a tabular within a figure environment. (Also, as egreg mentioned, an \includegraphics is by no means limited to being within a figure.)

Therefore, you can use standard tabular to lay out your images. An example is below, where I also used the adjustbox package to vertically center the images, as in e.g. https://tex.stackexchange.com/a/46390/586 (The image used is from the mwe package, so if that is installed the code should compile directly.)

\documentclass{article}
\usepackage{graphicx}
\usepackage{adjustbox}
\newcommand\animage{\adjustbox{valign=m,vspace=1pt}{\includegraphics[width=.2\linewidth]{example-image}}}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{cccc}
       & Column 1 & Column 2 & Column 3 \\
Row 1  & \animage & \animage & \animage \\
Row 2  & \animage & \animage & \animage \\
Row 3  & \animage & \animage & \animage 
\end{tabular}
\caption{Figures}
\end{figure}
\end{document}

enter image description here

Related Question