Search code examples
latex

How to set 3 pictures on the same line


I'm writing my thesis report and I get some help about LaTeX. I would like to set 3 pictures on the same line and make 3 x 3 pictures per page.

This is my script :

\begin{figure}[!h]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./Stage/Data/Field5_SN_map_final.png}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./Stage/Data/Field6_SN_map_final.png}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{./Stage/Data/Field7_SN_map_final.png}
    \end{subfigure}
\end{figure}

But I get some errors :

enter image description here

Do you have any idea to solve my problem ?

Thank you !


Solution

  • I think you should define figures' width in this way: \includegraphics[width=0.3\linewidth]{your_figure} and removing width from \subfigure. So the code should be like this:

    \begin{figure}[!h]
        \centering
        \begin{subfigure}[b]
            \includegraphics[width=0.3\linewidth]{./Stage/Data/Field5_SN_map_final.png}
        \end{subfigure}
        \begin{subfigure}[b]
            \includegraphics[width=0.3\linewidth]{./Stage/Data/Field6_SN_map_final.png}
        \end{subfigure}
        \begin{subfigure}[b]
            \includegraphics[width=0.3\linewidth]{./Stage/Data/Field7_SN_map_final.png}
        \end{subfigure}
    \end{figure}