0

How to place 8 figures like this in start of page in IEEE format using overleaf. my code is this it only palced three figures in a row but when i put 4 figure it doesnt fit in a row.

\begin{figure*}[]
    \centering
    %\begin{subfigure}{\columnwidth}
        %\centering
        \subfloat[aaaaaaaaaaa.]{\includegraphics[width=0.2\textwidth]{a.png}
        %\caption{}
        \label{fig:CS_2n}
        }\hfil
    %\end{subfigure}
    %\begin{subfigure}{\columnwidth}
        %\centering
          %\centering
        \subfloat[bbbbbbbbbbbbb]{\includegraphics[width=0.2\textwidth]{v.png}
        \caption{vvvvvvvvvvvvvvvvvvvvvvvvvv}
        \label{fig:CS_3n}
        }\hfil
    %\end{subfigure}
    %\begin{subfigure}{\columnwidth}
        %\centering
        \subfloat[cccccccccccccccc.]{\includegraphics[width=0.2\textwidth]{cv.png}
        %\caption{}
        \label{fig:CS_3n}
        }\hfil
        \subfloat[dddddddddddddddd]{\includegraphics[width=0.2\textwidth]{tt.png}
        %\caption{}
        \label{fig:CS_3n}
        }\hfil
        \caption{fffffffffffffffffffffffffffffffff}%
\end{figure*}

from my code when i tried to do this it looks like this beacuse i need to put separate caption for first two iamges and last two images

However, the sample picture is this first two images have separate caption and last two have separate caption and alugned horizontally next to each other

2
  • 2
    4 images that are each 0.3\textwidth wide can not fit side by side into the textwidth. (4*0.3\textwidth=1.2\textwidth). Reduce the widths of the images to 0.25\extwidth or smaller and they should fit.
    – leandriis
    Commented Aug 13, 2021 at 16:15
  • thanks the othe problem i am facing now is when i gave caption it moves figures down. how to resolve this
    – user12
    Commented Aug 13, 2021 at 16:28

1 Answer 1

2

Consider @Leonardiis comment, your code fragment extended to MWE should/can be:

\documentclass{ieeetran}
\usepackage[draft]{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure*}[ht]
    \centering
    \setkeys{Gin}{width=0.24\linewidth} % <---
\subfloat[aaaaaaaaaaa.      \label{fig:CS_2n}]{\includegraphics{example-image} }\hfil
\subfloat[bbbbbbbbbbbbb.    \label{fig:CS_3n}]{\includegraphics{example-image} }\hfil
\subfloat[cccccccccccccccc. \label{fig:CS_3n}]{\includegraphics{example-image} }\hfil
\subfloat[dddddddddddddddd. \label{fig:CS_3n}]{\includegraphics{example-image} }

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:first}

\bigskip
\subfloat[aaaaaaaaaaa.      \label{fig:CS_2n}]{\includegraphics{example-image} }\hfil
\subfloat[bbbbbbbbbbbbb.    \label{fig:CS_3n}]{\includegraphics{example-image} }\hfil
\subfloat[cccccccccccccccc. \label{fig:CS_3n}]{\includegraphics{example-image} }\hfil
\subfloat[dddddddddddddddd. \label{fig:CS_3n}]{\includegraphics{example-image} }

\caption{fffffffffffffffffffffffffffffffff}%
\label{fig:second}
\end{figure*}
\end{document}

which produce:

enter image description here

As you can see, result is as expected. All figure elements are on correct place.

edit: If you like to have two rows of \subfloats, just add another row of them:

\begin{figure*}
    \centering
    \setkeys{Gin}{width=0.22\linewidth} % <---
\subfloat[aaaaaaaaaaa.      \label{fig:CS_2n}]{\includegraphics{example-image} }\hfil
\subfloat[bbbbbbbbbbbbb.    \label{fig:CS_3n}]{\includegraphics{example-image} }\hfil
\subfloat[cccccccccccccccc. \label{fig:CS_4n}]{\includegraphics{example-image} }\hfil
\subfloat[dddddddddddddddd. \label{fig:CS_5n}]{\includegraphics{example-image} }

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:first}

\bigskip
\subfloat[aaaaaaaaaaa.      \label{fig:CS_2n-2}]{\includegraphics{example-image} }\hfil
\subfloat[bbbbbbbbbbbbb.    \label{fig:CS_3n-2}]{\includegraphics{example-image} }\hfil
\subfloat[cccccccccccccccc. \label{fig:CS_4n-2}]{\includegraphics{example-image} }\hfil
\subfloat[dddddddddddddddd. \label{fig:CS_5n-2}]{\includegraphics{example-image} }

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:second}
\end{figure*}

which result is:

enter image description here

edit (2):

    \begin{figure*}
    \centering
    \setkeys{Gin}{width=0.48\linewidth} % <---
\begin{minipage}{0.48\linewidth}
\includegraphics{example-image}\hfil
\includegraphics{example-image}

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:first}
\end{minipage}
\hfill
\begin{minipage}{0.48\linewidth}
\includegraphics{example-image}\hfil
\includegraphics{example-image} 

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:second}
\end{minipage}

\bigskip
\begin{minipage}{0.48\linewidth}
\includegraphics{example-image}\hfil
\includegraphics{example-image}

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:third}
\end{minipage}
\hfill
\begin{minipage}{0.48\linewidth}
\includegraphics{example-image}\hfil
\includegraphics{example-image}

\caption{fffffffffffffffffffffffffffffffff}
\label{fig:fourth}
\end{minipage}
    \end{figure*}

enter image description here

4
  • Thanks but can you see i put 2 caption in my code .. Lik depicted in the figure given in question . See first 4 images .. (first 2 images have one caption ) the other two have separate caption. when i am tying to do this.. the last two images goes down .. i am pasting a sample picture in question
    – user12
    Commented Aug 13, 2021 at 19:03
  • Dear @Alex, but your code fragment doesn't reflect this. Showed image hasn't any common with it ... Please always provide MWE, not just code fragment and clear indicate what is your problem. It is summer time and my crystal ball went to holidays, So I hart to guess what you after.
    – Zarko
    Commented Aug 13, 2021 at 19:08
  • i provided whole example instead of MWE you can run and check its already pasting images but the two captions are the problem .. check code there are two captions \caption{vvvvvvvvvvvvvvvvvvvvvvvvvv} \caption{fffffffffffffffffffffffffffffffff}%
    – user12
    Commented Aug 13, 2021 at 19:15
  • 1
    Two caption are not problem. See edited answer. Again, please always provide an MWE, not only code fragment. You should be aware, that people here try voluntarily to help in their spare time. Require from them that they must reconstruct MWE from your fragment, special when you already have wrote your document, is not really kind!
    – Zarko
    Commented Aug 13, 2021 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .