如何在图形上添加水平文本?

如何在图形上添加水平文本?

我有以下一段乳胶代码来生成图形。这里我使用包\stackinset的命令stackengine为每一列(模型 1、模型 2 和模型 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}

在此处输入图片描述

假设行是相同的元素但不同的模型(查看子图例),我想为每一行添加另一个标签。我如何才能使输出看起来像这样:

在此处输入图片描述

答案1

我只是\rotatebox[origin=c]{90}{\bfseries Model 1\strut}在每行子图之前立即添加了。确保在子图行之间包含一个空白行(段落),或者更好的是,\\[10pt]在子图行之间添加一个空白行以提供额外的间隙。

我还更改了\stackinset规格,\stackinset{c}{}{t}{-.2in}{}{}使其自动位于图片上方中央,而不管实际图像大小。

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

在此处输入图片描述

答案2

我将使用tabularx环境和\thead命令来makecell代替\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} 

在此处输入图片描述

答案3

制作表格:

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

showframe选项仅用于显示与页边距相关的结果。

在此处输入图片描述

相关内容