[Tex/LaTex] How to insert multiple images side by side in both columns of a two column document

floatsminipagepositioningtwo-column

I have four images and i want to put them on top of the page side by side. I am writing on a two column document format. I drew the following picture to show how i want the pictures to look. I tried using minipage environment within figure* , but didn't work . Please advice.
A,B,C,D are images i want to insert

I also tried using this link, didn't work for me.
link Here is the code i tried using.

       \begin{figure*}
       \centering
       \begin{minipage}[b]{0.3\textwidth}
       \includegraphics[width=0.2\textwidth]{single_hop_wireless1.jpg}
       \caption{Pre processing memory graph}
       \end{minipage}

       \begin{minipage}[b]{0.3\textwidth}
       \includegraphics[width=0.2\textwidth]{single_hop_wireless2.jpg}
        \caption{Post processing memory graph}
       \end{minipage}

      \begin{minipage}[b]{0.3\textwidth}
      \includegraphics[width=0.2\textwidth]{single_hop_wireless3.jpg}
       \caption{Pre processing JVM memory graph}
       \end{minipage}

      \begin{minipage}[b]{0.3\textwidth}
     \includegraphics[width=0.2\textwidth]{single_hop_wireless4.jpg}
      \caption{Post processing JVM memory graph}
     \end{minipage}
    \end{figure*}

Thanks in advance.

Best Answer

Your code can't generate desired images, because (i) with empty lines between mini pages you actually requires that they should be each in own line (ii) with use of mini pages you will obtain 4 figures and not sub figures as is shown on example images.

Try the following:

\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}
       \begin{figure*}
       \centering
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Pre processing memory graph}
\end{subfigure}
%
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Post processing memory graph}
\end{subfigure}
%
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Pre processing JVM memory graph}
\end{subfigure}
%
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Post processing JVM memory graph}
\end{subfigure}
    \end{figure*}
\end{document}

enter image description here