0

I want to arrange 9 subfigures (.png files) across two columns - 5 subfigures in the first column (a, b, c, d, e) and 4 subfigures in the second column (f, g, h, i) - s.t. both the subfigures in both columns fill up the same amount of vertical space.

What I've current tried is something along the lines of the solution suggested in (Two Minipages, two times itemize - how to correct alignment). Instead of using the \begin{itemize} cmd, I've attempted to stack subfigures on top of each other as follows:

\documentclass[journal]{IEEEtran}
\usepackage{multicol}
% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
  \usepackage[pdftex]{graphicx}
% declare the path(s) where your graphic files are
  \graphicspath{{images/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
  \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

% *** SUBFIGURE PACKAGES ***
\ifCLASSOPTIONcompsoc
  \usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf{subfig}
\else
  \usepackage[caption=false,font=footnotesize]{subfig}
\fi

% *** FLOAT PACKAGES ***
%
\usepackage{fixltx2e}

\begin{document}

\begin{figure*}
\begin{multicols}{2}
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(a).png}
    \label{fig:a}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(b).png}
    \label{fig:b}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(c).png}
    \label{fig:c}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(d).png}
    \label{fig:d}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(e).png}
    \label{fig:e}
    }

    \columnbreak

    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(f).png}
    \label{fig:f}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(g).png}
    \label{fig:g}
    }
    \\
    \subfloat{
    \includegraphics[width=0.45\textwidth]{IEEEtran/images/figure(h).png}
    \label{fig:h}
    }
\end{multicols}
\caption{dummy caption}
\end{figure*}

\end{document}

This seems to work for a single column, albeit only for two subfigures, after which the third, fourth, etc. subfigures gets "pushed" to the next column without my specifying it.

enter image description here

When I add all 9 subfigures as in the code above, the compiled document simply DOESN'T DISPLAY any of the images:

enter image description here

EDIT: I'm using the template provided by IEEE for their transactions journals.

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Stefan Pinnow Sep 15 '19 at 7:11
  • Instead of .45\textwidth, you can use \linewidth... – Paul Gaborit Sep 15 '19 at 7:51
  • Meanwhile I provide answer to your problem. Do you tested it? Does it gives result which you like to achieve? – Zarko Sep 15 '19 at 9:53
  • If you want to take an entire page/column, use [p] figures. Otherwise there are limits on how many floats per page and total space taken by floats vs. text. You can avoid the number limit using [!]. Not sure about the space limit. – John Kormylo Sep 15 '19 at 16:15
2

Unfortunately your question don't provide some important information (see comment below question). It seems that your images are to big that can be fit on one page. You need to reduce it accordingly.

Based on guessing, you probably looking for something like this:

enter image description here

I suggest to use tabularx instead of multicolumn. Using it you can better arrange positioning of images. Also labeling of images without adding them captions haven't sense so I delete them:

\documentclass[demo]{IEEEtran}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{subfig}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure*}
\setkeys{Gin}{width=\linewidth, 
              height=0.45\linewidth,
              keepaspectratio}
    \begin{tabularx}{\linewidth}{@{} XX @{}}
\subfloat{\includegraphics{IEEEtran/images/figure(a).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(b).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(c).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(d).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(e).png}}
    &
\subfloat{\includegraphics{IEEEtran/images/figure(f).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(g).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(h).png}}

\subfloat{\includegraphics{IEEEtran/images/figure(i).png}}
\end{tabularx}
\caption{dummy caption}
\end{figure*}
\end{document}

addendum: Another possibilities is vertical centered positioning of images is columns. IN this example are added sub-captions to images and labels to it:

\documentclass[demo]{IEEEtran}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{subfig}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure*}
\renewcommand\tabularxcolumn[1]{m{#1}}
\setkeys{Gin}{width=\linewidth, 
              height=0.44\linewidth,
              keepaspectratio}
    \begin{tabularx}{\linewidth}{@{} XX @{}}
\subfloat[\label{fig:a}]{\includegraphics{IEEEtran/images/figure(a).png}}

\subfloat[\label{fig:b}]{\includegraphics{IEEEtran/images/figure(b).png}}

\subfloat[\label{fig:c}]{\includegraphics{IEEEtran/images/figure(c).png}}

\subfloat[\label{fig:d}]{\includegraphics{IEEEtran/images/figure(d).png}}

\subfloat[\label{fig:e}]{\includegraphics{IEEEtran/images/figure(e).png}}
    &
\subfloat[\label{fig:f}]{\includegraphics{IEEEtran/images/figure(f).png}}

\subfloat[\label{fig:g}]{\includegraphics{IEEEtran/images/figure(g).png}}

\subfloat[\label{fig:h}]{\includegraphics{IEEEtran/images/figure(h).png}}

\subfloat[\label{fig:i}]{\includegraphics{IEEEtran/images/figure(i).png}}
\end{tabularx}
\caption{dummy caption}
\end{figure*}
\end{document}

enter image description here

| improve this answer | |
  • thanks! the second solution worked like a treat! – Song Andy Sep 15 '19 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.