I want to plot the figures side by side, so for this I have the following code:
\usepackage{subcaption}
\begin{document}
\begin{figure}
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{rect-dtft-32}
\caption{caption 1}
\label{rect-32}
\end{subfigure}
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{bart-dtft-32}
\caption{caption 2}
\label{bart-32}
\end{subfigure}
\begin{subfigure}{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{hamm-dtft-32}
\caption{caption 3}
\label{hamm-32}
\end{subfigure}
\end{figure}
\end{document}
and my result is
Figures are plotted vertically instead of horizontally. Where am I making a mistake?
Thanks!

subfigureenvironments or use\hfillinstead of the empty line if you want the first image to align with the left margin while the third image is aligned with the right margin. – leandriis May 22 '21 at 09:09