61

I'd like my figures to be one on top of the other, rather than next to each other, so that they are larger and spread along the page width. How do I do this? Here is my code:

\begin{figure}[H]
\centering
   \begin{subfigure}[b]{0.3\textwidth}
   \includegraphics[width=0.8\textwidth]{Nvariousg1}
   \caption{}
   \label{fig:Ng1} 
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
   \includegraphics[width=0.8\textwidth]{Nvariousg2}
   \caption{}
   \label{fig:Ng2}
\end{subfigure}
\caption{(a) Numerical solutions for the small-time system with a constant-curvature body shape showing the scaled leading-order veritcal reaction force $N_0$ versus the scaled body mass $M$ for various values of $g$. Again, $I=M$ for definiteness and $A=0.7$. (b) As for (a) but over a wider range of values of $M,I$.}
\end{figure}
0

4 Answers 4

76

Since you're looking to make the two graphs larger, you could (a) increase the widths of the two subfigure environments to, say, 0.75\textwidth and (b) set the widths of the graphs to 1\linewidth, i.e., to the full width of the enclosing subfigure environments. LaTeX will automatically insert a line break between the two subfigures.

Example of two figures stacked on top of each other

\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}  % remove 'demo' option for your real document

\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.55\textwidth}
   \includegraphics[width=1\linewidth]{Nvariousg1}
   \caption{}
   \label{fig:Ng1} 
\end{subfigure}

\begin{subfigure}[b]{0.55\textwidth}
   \includegraphics[width=1\linewidth]{Nvariousg2}
   \caption{}
   \label{fig:Ng2}
\end{subfigure}

\caption[Two numerical solutions]{(a) Numerical solutions for the small-time system 
with a constant-curvature body shape showing the scaled leading-order veritcal 
reaction force $N_0$ versus the scaled body mass $M$ for various values of $g$. 
Again, $I=M$ for definiteness and $A=0.7$. (b) As for (a) but over a wider range of 
values of $M,I$.}
\end{figure}
\end{document}
6
  • Seems like parts here are deprecated. 0.55 appears above/below the entire figure, so does a and b.
    – jibo
    Commented Mar 19, 2018 at 15:53
  • @jibo - I'm afraid I have no idea what you're talking about. For sure, I see no "0.55" appearing anywhere, and "(a)" and "(b)" show up right where they're supposed to show up, viz., below the respective graphs. Please clarify what you're experiencing
    – Mico
    Commented Mar 19, 2018 at 15:57
  • It's hard to explain without pictures. Running the demo code as you provided yielded no problems. However as soon as adding own picture files what I explained above appeared. There might be some compatibility issue with another package that I am using, don't know which though. I managed to solve the issue by using \subfloat instead of \begin{subfigure}
    – jibo
    Commented Mar 19, 2018 at 16:49
  • 1
    Yes subfigure was loaded in addition to subcaption. That was what caused the troubles, so now it is working fine (just by disabling one of them).
    – jibo
    Commented Mar 27, 2018 at 11:59
  • 1
    @jibo - I'm glad you figured out the cause of the problem. By the way, the subfigure package is deprecated and shouldn't be used anymore.
    – Mico
    Commented Mar 27, 2018 at 21:30
7

The subfigure package is now deprecated. subfig can be used instead. Here is how to use it:

\documentclass{article}
\usepackage{subfig}
\usepackage[demo]{graphicx}  % remove 'demo' option for your real document

\begin{document}
\begin{figure}
  \centering
  \subfloat[a][a]{\includegraphics{a.png} \label{fig:a}} \\
  \subfloat[b][b]{\includegraphics{b.png} \label{fig:b}}
  \caption{a + b} \label{fig:AB}
\end{figure}
\end{document}
3
  • Any example pictures?
    – Sterling
    Commented Oct 27, 2020 at 4:30
  • 2
    @Sterling You may try \includegraphics[scale=0.3]{example-image-a}
    – sreeraj t
    Commented Jun 6, 2021 at 0:31
  • This works in overleaf with no errors. Thanks!
    – MimSaad
    Commented Aug 26, 2022 at 13:02
6

An other option is provided here.

\documentclass[smallextended]{svjour3}
\usepackage{lipsum}% Just for this example
\usepackage{graphicx}
\begin{document}

See Figure~\ref{fig:myfig}(a) or~(b). \lipsum[1]

\begin{figure}
  \centering
  \begin{tabular}{@{}c@{}}
    \includegraphics[width=.7\linewidth,height=75pt]{example-image-a} \\[\abovecaptionskip]
    \small (a) An image
  \end{tabular}

  \vspace{\floatsep}

  \begin{tabular}{@{}c@{}}
    \includegraphics[width=.6\linewidth,height=100pt]{example-image-b} \\[\abovecaptionskip]
    \small (b) Another image
  \end{tabular}

  \caption{This is a figure caption}\label{fig:myfig}
\end{figure}

\lipsum[2]

\end{document}
1
  • 1
    how to label 1.1(a) and 1.1(b). Mean to say ...how would you label each of the subfigures? Commented Oct 12, 2018 at 7:10
5

Just add '\\' between the subfigures.

\begin{figure}[H]
\centering
   \begin{subfigure}[b]{0.3\textwidth}
   \includegraphics[width=0.8\textwidth]{Nvariousg1}
   \caption{}
   \label{fig:Ng1} 
\end{subfigure}

\\

\begin{subfigure}[b]{0.3\textwidth}
   \includegraphics[width=0.8\textwidth]{Nvariousg2}
   \caption{}
   \label{fig:Ng2}
\end{subfigure}
\caption{(a) Numerical solutions for the small-time system with a constant-curvature body shape showing the scaled leading-order veritcal reaction force $N_0$ versus the scaled body mass $M$ for various values of $g$. Again, $I=M$ for definiteness and $A=0.7$. (b) As for (a) but over a wider range of values of $M,I$.}
\end{figure}
1
  • 4
    If you're introducing blank lines, that surely would introduce a break, meaning there's no need for \\.
    – Werner
    Commented Nov 6, 2018 at 0:52

You must log in to answer this question.

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