6

I would like to implement the following figure in LaTeX, including the axis labels. (Assume that in this image matrix there are 12 individual square pictures ... can I fix the size of the individual square?)

How can this be done? I have worked with the packages graphicx, subcaption and subfigure before, but I do not quite understand them well enough to do this.

The figure should have width=0.8\textwidth and go in between two text paragraphs.

Thank you for any advice.

This is how it should look:

text blablabla

enter image description here

text blablabla

1
  • Two options: the floatrow package gives you more control over positioning subfigures and captions. But in this case I would revert to two other packages: tikz which is very versatile in positioning nodes (the images in this case) and tabularray since your layout strongly resembles a table with figures and a row / column designator.
    – alchemist
    May 28, 2023 at 18:28

3 Answers 3

9
  • One way is to put images in table, for example based on tabularray package, and in the first column and row write desired informations about images.
  • For vertical positioning of images you need to move images baselines to their vertical center. For this is sensible to use package adjustbox. - - By using it, you can also determine common settings for images.
  • For rotating of texts in the first column are used packages rotating and makecell for the \rothead command:
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}


\begin{document}
    \begin{figure}[ht]
    \settowidth\rotheadsize{merge}
\adjustboxset{width=\linewidth,valign=c}
\begin{tblr}{colsep=1pt,
             colspec = {@{} Q[c,m] *{4}{X[c]} @{} },
             cell{2-Z}{1} = {cmd=\rothead},
             rowsep  = 1pt
             }
        \centering
    & 1:0   & 1000:1    &   100:1   &   10:1            \\
mCh
    &   \adjincludegraphics{example-image-a}
        &   \adjincludegraphics{example-image-b}
            &   \adjincludegraphics{example-image-c}
                &   \adjincludegraphics{example-image}     \\
eGFP
    &   \adjincludegraphics{example-image-a}
        &   \adjincludegraphics{example-image-b}
            &   \adjincludegraphics{example-image-c}
                &   \adjincludegraphics{example-image}     \\
merge
    &   \adjincludegraphics{example-image-a}
        &   \adjincludegraphics{example-image-b}
            &   \adjincludegraphics{example-image-c}
                &   \adjincludegraphics{example-image}     \\
\end{tblr}
\caption{Caption for figure}
\label{fig:required}
    \end{figure}
\end{document}

enter image description here

5

Since the OP's description contains neither caption nor figure number, I assume that no label or reference to it is needed. I therefore construct the image as a simple tabbed stack. The vertical and horizontal gap between rows and columns can be adjusted to suit.

\documentclass{article}
\usepackage{graphicx,tabstackengine,lipsum}
\setstacktabbedgap{3pt}
\begin{document}
\lipsum[3]

\bigskip\noindent\tabbedShortstack{
 &1:0 & 1000:1 & 100:1 & 10:1\\
\rotatebox[origin=c]{90}{mCh\strut}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}\\
\rotatebox[origin=c]{90}{eGFP\strut}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}\\
\rotatebox[origin=c]{90}{merge\strut}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
  \raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}
}\bigskip

\lipsum[2]
\end{document}

enter image description here

3

Assuming your images have the same proportions, you can make a tabular* with vertically centered images (using an inner tabular).

I define local commands for the job, so not to clutter input.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[htp]

% local commands to ease input
\newcommand{\imagewidth}{\dimexpr(\columnwidth-\ht\strutbox-\dp\strutbox-12pt)/4\relax}
\newcommand{\addimage}[1]{%
  \begin{tabular}{@{}c@{}}
  \includegraphics[width=\imagewidth]{#1}
  \end{tabular}%
}
\newcommand{\addlabel}[1]{%
  \begin{tabular}{@{}c@{}}
  \rotatebox{90}{#1\strut}
  \end{tabular}%
}
% locally set \tabcolsep to zero
\setlength{\tabcolsep}{0pt}

\begin{tabular*}{\columnwidth}{@{}r@{\extracolsep{\fill}}cccc@{}}
& 1:0 & 1000:1 & 100:1 & 10:1 \\

\addlabel{mCh} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c} \\

\addlabel{eGFP} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c} \\

\addlabel{merge} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c}
\end{tabular*}

\caption{This is a $3\times 4$ arrangement of figures}

\end{figure}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .