# Shows figures on the right side

I added figures to my latex file and for some reason, it shows them on the right side instead of in the center. How can I fix it?

\begin{figure}
\centering
\subcaptionbox{A Constant Rectangle\label{fig:2a}}[.4\linewidth]{\includegraphics[width=1.6in]{rectangle_graph.png}}
\hspace{1em}
\vspace{0.3em}
\subcaptionbox{A Moving Square\label{fig:2b}}[.4\linewidth]{\includegraphics[width=1.6in]{moving_block_graph.png}}
\vspace{0.3em}
\subcaptionbox{Green Lines\label{fig:2c}}[.4\linewidth]{\includegraphics[width=1.6in]{green_lines_graph.png}}\hspace{1em}
\subcaptionbox{Diagonals\label{fig:2d}}[.4\linewidth]{\includegraphics[width=1.6in]{diagonals_graph.png}}
\caption{caption.}
\label{figure2}
\end{figure}

• Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. -- Does Figure alignment using sub caption help? – Bobyandbob Aug 19 '18 at 7:46
• Do you want to maybe use \begin{figure*} and \end{figure*}? Note the asterisk. – Johannes_B Aug 19 '18 at 7:55
• If I add * it spreads on both columns. – Shani Gamrian Aug 19 '18 at 8:01
• What I can see from your picture is that the images have a white border on their left, which can be cured by trimming them (see the trim option); moreover, 1.6in is probably larger than 0.4\linewidth. You can test whether my guess on the white border is right by trying \fbox{\includegraphics{rectangle_graph.png}} and seeing what TeX thinks about the image. – egreg Aug 19 '18 at 9:18

do not use absolute values for the width of the images! 3.2in for two images is wider than the column width!

\begin{figure}
\centering
\subcaptionbox{A Constant Rectangle\label{fig:2a}}[.45\linewidth]{%
\includegraphics[width=\linewidth]{rectangle_graph.png}}