1

I want to make my subfigures bigger and keep them on the same line. Is there any way to increase the textwidth for the figure? Or are there any other ways to do this? Thanks in advance.

\begin{figure}[h]
     \centering
     \begin{subfigure}{0.49\textwidth}
         \centering
         \caption{Annual Return}
         \includegraphics[width=\textwidth]{return.png}
     \end{subfigure}
 \begin{subfigure}{0.49\textwidth}
     \centering
     \caption{Annual Volatility}
     \includegraphics[width=\textwidth]{volatility.png}
 \end{subfigure}

\end{figure}

imnothere
  • 14,215
NYRAHHH
  • 121

1 Answers1

1

Your example (even though not compilable, see here) came pretty close:

\documentclass{article}

\usepackage{graphicx} \usepackage{subcaption}

\begin{document}

\begin{figure} \begin{subfigure}[h]{0.45\linewidth} \includegraphics[width=\linewidth]{example-image-a} \caption{left image} \end{subfigure}% \hfill \begin{subfigure}[h]{0.45\linewidth} \includegraphics[width=\linewidth]{example-image-b} \caption{right image} \end{subfigure} \caption{There are two subfigures inside a figure environment} \end{figure}

\end{document}

The code above will yield the following output:

subfigures

phil-elkabat
  • 2,055
  • +1. The comment character after the second instance of \end{subfigure} is not essential. However, just in case the OP chooses the widths of the two subfigure environments to something like 0.495\textwidth, it's essential to use a % character immediately after the first instance of \end{subfigure}. – Mico Aug 11 '20 at 08:36
  • 1
    @Mico, you really have eyes like a hawk! Thank you, edit has been made. – phil-elkabat Aug 11 '20 at 08:42