latex subfigures overleaf code example

Example 1: overleaf subfigures

% Side-by-side subfigures

\usepackage{subcaption}

\begin{figure}[h]
    \begin{subfigure}{0.5\textwidth}
        \includegraphics[width=0.9\linewidth]{image1}
        \caption{Caption1}
        \label{fig:sub1}
    \end{subfigure}
    \begin{subfigure}{0.5\textwidth}
        \includegraphics[width=0.9\linewidth]{image2}
        \caption{Caption2}
        \label{fig:sub2}
    \end{subfigure}
    \caption{Subfigures}
    \label{fig:Figure1}
\end{figure}

Example 2: subfigure latex

\begin{figure}
	\centering
	\begin{subfigure}[b]{0.3\textwidth}
		\centering
		\includegraphics[width=\textwidth]{first image}
		\caption{first image}
		\label{fig:ui1}
	\end{subfigure}
	\hfill
	\begin{subfigure}[b]{0.3\textwidth}
		\centering
		\includegraphics[width=\textwidth]{third image}
		\caption{third image}
		\label{fig:ui3}
	\end{subfigure}
	\label{fig:three graphs}
\end{figure}

Tags:

Misc Example