1

I am looking for a way to create subplot like following

enter image description here

I have created a fig_subplot.tex file

\begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{1.eps}
  \end{subfigure}%   
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{2.eps}
  \end{subfigure}\\%  
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{3.eps}
  \end{subfigure}%
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{4.eps}
  \end{subfigure}%

and addede it to my main.tex file

\begin{figure}[htb]
\centering
\input{fig_subplot}
\caption{4x4 grid}\label{fig:3}
\end{figure}

But how do I add tall rectangular box labeled "5" in my fig_subplot.tex.

  • You could arrange the plots in a tabular with a multirow for the 5th plot. – user121799 Sep 5 '18 at 15:49
  • or I create a table with two columns. In 1st column, insert 4x4 grid and 2nd gets "5". – NAASI Sep 5 '18 at 15:52
  • Yes, that should also work, may however require more adjustments of the colsep. – user121799 Sep 5 '18 at 15:56
  • Is there any possibility of getting desired result with subfigure option? – NAASI Sep 5 '18 at 15:59
  • Cant you put subfigures in a tabular? (I always get confused because there are too many subfigure packages around. If it does not work with your version of subfigure, you could just use \captionof.) – user121799 Sep 5 '18 at 16:01
1

Place the 4x4 grid in a minipage with b alignment, and add a fifth \includegraphics immediately after that minipage. By the way, the subfigure environments are not really needed in your example, as you're not adding any captions to them. In the code below I added a second example without the subfigures.

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{minipage}[b]{0.8\linewidth}
\begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image}
  \end{subfigure}%   
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-a}
  \end{subfigure}\\%  
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-b}
  \end{subfigure}%
  \begin{subfigure}[b]{.48\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-c}
  \end{subfigure}%
\end{minipage}%
\includegraphics[width=0.17\linewidth,height=6.9cm]{example-image-10x16}
\end{figure}

\begin{figure}
\centering
\begin{minipage}[b]{0.8\linewidth}
    \includegraphics[width=.49\textwidth]{example-image}
    \includegraphics[width=.49\textwidth]{example-image-a} 

    \vspace{2pt}

    \includegraphics[width=.49\textwidth]{example-image-b}
    \includegraphics[width=.49\textwidth]{example-image-c}
\end{minipage}
\includegraphics[width=0.17\linewidth,height=7.2cm]{example-image-10x16}
\end{figure}
\end{document}

In the above code I set the size of the tall image manually. It is however possible to get the correct height without trial and error, by putting the minipage in a box, and using the height of that box. An example:

\begin{figure}
\centering
\newsavebox\ImageGrid % define a new savebox
\sbox{\ImageGrid}{% save the minipage with gridded images in box
\begin{minipage}[b]{0.8\linewidth}
    \includegraphics[width=.49\textwidth]{example-image}
    \includegraphics[width=.49\textwidth]{example-image-a} 

    \vspace{2pt}

    \includegraphics[width=.49\textwidth]{example-image-b}
    \includegraphics[width=.49\textwidth]{example-image-c}
\end{minipage}}%
\usebox\ImageGrid % typeset the box
\includegraphics[width=0.17\linewidth,height=\ht\ImageGrid]{example-image-10x16} % use \ht (height) of box for image height
\end{figure}

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.