4

I have the following piece of latex code to produce a figure. Here I am using the \stackinset command of the stackengine package to write labels for each column (Model 1, Model 2 and Model 3).

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\begin{document}
%% ensemble time course
\begin{figure*}[t!]
    \begin{subfigure}{0.3\textwidth}
        \stackinset{l}{0.4in}{b}{1.2in}{\textbf{Smad7 mRNA Obs Profile}}{%
            \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/Smad7mRNAObs}}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \stackinset{l}{0.4in}{b}{1.2in}{\textbf{Smad7 Protein Obs Profile}}{%
            \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/Smad7Obs}}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \stackinset{l}{0.4in}{b}{1.2in}{\textbf{Ski mRNA Obs Profile}}{%
            \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/SkiObs}}
        \caption{Ski Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_ski}
    \end{subfigure}

    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/Smad7mRNAObs}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/Smad7Obs}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7protein}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/SkiObs}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_ski}
    \end{subfigure}
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/Smad7mRNAObs}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/Smad7Obs}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_Smad7m}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/SkiObs}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_ski}
    \end{subfigure}
\end{document}

enter image description here

Given that the rows are the same element but different models (look at the subfigure legends) I'd like to put another label for each row. How would I get the output to look something like this:

enter image description here

6

I just added \rotatebox[origin=c]{90}{\bfseries Model 1\strut} immediately before each row of subfigures. Make sure to include a blank line (paragraph) between the subfigure rows, or perhaps, better still, a \\[10pt] to provide extra gap between subfigure rows.

I also changed the \stackinset specification to \stackinset{c}{}{t}{-.2in}{}{} to make it auto centered above the picture, regardless of the actual image size.

\documentclass{article}
\usepackage[margin=1.5cm,landscape]{geometry}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\begin{document}
%% ensemble time course
\begin{figure*}[t!]
\rotatebox[origin=c]{90}{\bfseries Model 1\strut}
    \begin{subfigure}{0.3\textwidth}
        \stackinset{c}{}{t}{-.2in}{\textbf{Smad7 mRNA Obs Profile}}{%
            \includegraphics[width=\linewidth]{example-image}}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \stackinset{c}{}{t}{-.2in}{\textbf{Smad7 Protein Obs Profile}}{%
            \includegraphics[width=\linewidth]{example-image}}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \stackinset{c}{}{t}{-.2in}{\textbf{Ski mRNA Obs Profile}}{%
            \includegraphics[width=\linewidth]{example-image}}
        \caption{Ski Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_ski}
    \end{subfigure}

\rotatebox[origin=c]{90}{\bfseries Model 2\strut}
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7protein}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model2: Smad7 Not Reproduced}
        \label{fig:smad7_not_reproduced_ensemble_ski}
    \end{subfigure}

\rotatebox[origin=c]{90}{\bfseries Model 3\strut}
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_Smad7mRNA}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_Smad7m}
    \end{subfigure}%
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{example-image}
        \caption{Model 3: Ski Second Order Degradation}
        \label{fig:ski_second_order_deg_ski}
    \end{subfigure}
\end{figure*}
\end{document}

enter image description here

2

I would use a tabularx environment and a \thead command from makecell in the place of \stackinset:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\usepackage{caption, subcaption}
\usepackage{tabularx, makecell, floatrow}
\renewcommand{\theadfont}{\small\bfseries}
\renewcommand{\cellset}{\scshape}
\settowidth{\rotheadsize}{\textsc{Model 0}}
\usepackage[demo]{graphicx}%
\usepackage{rotating}
\usepackage[showframe]{geometry}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup[subfigure]{font=footnotesize, format=hang}%
\usepackage[usestackEOL]{stackengine}

\begin{document}
%% ensemble time course
\begin{figure*}[t!]
\begin{tabularx}{\linewidth}{@{}cXXX@{}}
& \thead{Smad7 mRNA Obs Profile} & \thead{Smad7 Protein Obs Profile} & \thead{Ski mRNA Obs Profile} \\
\rotcell{Model 1} & \begin{subfigure}{0.3\textwidth}
                   \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/Smad7mRNAObs}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
 & \begin{subfigure}{\linewidth}
            \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/Smad7Obs}
        \caption{Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_Smad7}
    \end{subfigure}%
  & \captionsetup[subfigure]{margin={-2mm, 0mm}}
\begin{subfigure}{0.3\textwidth}
            \includegraphics[width=\linewidth]{/smad7_reproduced/EnsembleTimeCourse/SkiObs}
       \caption{Ski Model1: Smad7 Reproduced}
        \label{fig:smad7_reproduced_ensemble_ski}
    \end{subfigure}\bigskip\\
%
\rotcell{Model 2} & \captionsetup[subfigure]{margin={-2mm, 0mm}}\begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/Smad7mRNAObs}
        \caption{Model2: Smad7 Not Reprodu\-ced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7mRNA}
    \end{subfigure}%
    & \captionsetup[subfigure]{margin={-2mm, 0mm}}\begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/Smad7Obs}
        \caption{Model2: Smad7 Not Reprodu\-ced}
        \label{fig:smad7_not_reproduced_ensemble_Smad7protein}
    \end{subfigure}%
   & \captionsetup[subfigure]{margin={-2mm, 0mm}}\begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/smad7_not_reproduced/EnsembleTimeCourse/SkiObs}
        \caption{Model2: Smad7 Not Reprodu\-ced}
        \label{fig:smad7_not_reproduced_ensemble_ski}
    \end{subfigure}\bigskip\\
%
\rotcell{Model 3} & \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/Smad7mRNAObs}
        \caption{Model 3: Ski Second Order De\-gradation}
        \label{fig:ski_second_order_deg_Smad7mRNA}
    \end{subfigure}%
    & \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/Smad7Obs}
        \caption{Model 3: Ski Second Order De\-gradation}
        \label{fig:ski_second_order_deg_Smad7m}
    \end{subfigure}%
    & \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\linewidth]{/ski_second_order_deg/EnsembleTimeCourse/SkiObs}
        \caption{Model 3: Ski Second Order De\-gradation}
        \label{fig:ski_second_order_deg_ski}
    \end{subfigure}
\end{tabularx}
\end{figure*}

\end{document} 

enter image description here

2

Make a table:

\documentclass{article}
\usepackage[a4paper,margin=2cm,showframe]{geometry}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{booktabs}

\captionsetup[subfigure]{justification=raggedright}

\newcommand{\vertical}[1]{%
  \begin{tabular}{@{}c@{}}
  \rotatebox[origin=bl]{90}{#1}
  \end{tabular}%
}

\begin{document}
%% ensemble time course

\begin{figure*}[tp!]
\centering

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} c@{\hspace{1ex}}ccc @{}}
&\makebox[0.3\textwidth]{\textbf{Smad7 mRNA Obs Profile}}
&\makebox[0.3\textwidth]{\textbf{Smad7 Protein Obs Profile}}
&\makebox[0.3\textwidth]{\textbf{Ski mRNA Obs Profile}}
\\
\addlinespace
\vertical{\textbf{Model 1}}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model1: Smad7 Reproduced}
  \label{fig:smad7_reproduced_ensemble_Smad7mRNA}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model1: Smad7 Reproduced}
  \label{fig:smad7_reproduced_ensemble_Smad7}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Ski Model1: Smad7 Reproduced}
  \label{fig:smad7_reproduced_ensemble_ski}
\end{subfigure}
\\
\addlinespace
\vertical{\textbf{Model 2}}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model2: Smad7 Not Reproduced}
  \label{fig:smad7_not_reproduced_ensemble_Smad7mRNA}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model2: Smad7 Not Reproduced}
  \label{fig:smad7_not_reproduced_ensemble_Smad7protein}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model2: Smad7 Not Reproduced}
  \label{fig:smad7_not_reproduced_ensemble_ski}
\end{subfigure}
\\
\addlinespace
\vertical{\textbf{Model 3}}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model 3: Ski Second Order Degradation}
  \label{fig:ski_second_order_deg_Smad7mRNA}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model 3: Ski Second Order Degradation}
  \label{fig:ski_second_order_deg_Smad7m}
\end{subfigure}
&\begin{subfigure}{0.3\textwidth}
  \includegraphics[width=\linewidth]{example-image}
  \caption{Model 3: Ski Second Order Degradation}
  \label{fig:ski_second_order_deg_ski}
\end{subfigure}
\end{tabular*}

\end{figure*}

\end{document}

The showframe option is just to show what the result will be with respect to the page margins.

enter image description here

  • Thanks. I have a solution which uses the \stackinset strategy but I'll certainly think about making a table next time. – CiaranWelsh Oct 27 '17 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.