Skip to content

Instantly share code, notes, and snippets.

@baileythegreen
Last active September 8, 2021 12:08
Show Gist options
  • Save baileythegreen/a8f8e7c17e360c9310bdf2ed3ef48008 to your computer and use it in GitHub Desktop.
Save baileythegreen/a8f8e7c17e360c9310bdf2ed3ef48008 to your computer and use it in GitHub Desktop.
Example of a figure with two subfigures that each take up half of a page (portrait layout). The commented \captionsetup lines were not needed, but are placed correctly to affect subcaptions.
\begin{figure}
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{Images/UKB1/Manhattans/total_femur_mh.pdf}
%\captionsetup{skip=15pt, width=.9\textwidth}
\subcaption[UKB1 femur length]{Femur length in UKB1}
\end{subfigure}
\vspace{1cm}
\begin{subfigure}{\linewidth}
\includegraphics[width=\linewidth]{Images/UKB1/Manhattans/total_humerus_mh.pdf}
%\captionsetup{skip=15pt, width=.9\textwidth}
\subcaption[UKB1 humerus length]{Humerus length in UKB1}
\end{subfigure}
\captionsetup{skip=15pt, width=.85\textwidth}
\caption[Femur and humerus Manhattans]{GWAS results for femur and humerus length in the UKB1 cohort.\\
\vspace{2mm}
\scriptsize GWAS results for femur and humerus length (with height included as a covariate) in the UKB1 cohorts. The Manhattan plots show the −log(p-values) for the included SNPs.}
\label{fig:fem_hum_mh}
\end{figure}
\makeatletter
% Insert "Figure" or "Table" in "list of" entries
\newcommand\numberprefix{}
\def\numberline#1{\hb@xt@\@tempdima{\numberprefix #1\hfil}}
\def\l@figure#1#2{\@tocline{1}{3pt plus2pt}{0pt}{8pc}{}%
{\renewcommand\numberprefix{\hspace{1cm} Figure~}#1}{#2}}
\def\l@table#1#2{\@tocline{0}{3pt plus2pt}{0pt}{8pc}{}%
{\renewcommand\numberprefix{\hspace{1cm} Table~}#1}{#2}}
\def\l@subtable#1#2{\@tocline{0}{3pt plus2pt}{0pt}{8pc}{}%
{\renewcommand\numberprefix{\hspace{2.5cm} ~}{\footnotesize#1}}{}}
\def\l@subfigure#1#2{\@tocline{0}{3pt plus2pt}{0pt}{8pc}{}%
{\renewcommand\numberprefix{\hspace{2.5cm} ~}{\footnotesize#1}}{}}
\makeatother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment