15

I try to put figures in 2X2, but they appear in 4 rows.

\begin{figure*}
\begin{minipage}{\textwidth}
\centering
\begin{subfigure}[b]{1\textwidth}
\centering
    \includegraphics[scale=0.3]{images/mean/N14.png}
    \caption[Network2]%
    {{\small Network 1}}    
\label{fig:mean and std of net14}
\end{subfigure}
\quad
 \begin{subfigure}[b]{1\textwidth}  
 \centering 
        \includegraphics[scale=0.29]{images/mean/N24.png}
        \caption[]%
        {{\small Network 2}}    
        \label{fig:mean and std of net24}
        \end{subfigure}

    \begin{subfigure}[b]{1\textwidth}   
 \centering 
        \includegraphics[scale=0.29]{images/mean/N34.png}
        \caption[]%
        {{\small Network 3}}    
        \label{fig:mean and std of net34}
        \end{subfigure}
        \quad
        \begin{subfigure}[b]{1\textwidth}   
 \centering 
        \includegraphics[scale=0.29]{images/mean/N44.png}
        \caption[]%
        {{\small Network 4}}    
        \label{fig:mean and std of net44}
        \end{subfigure}


        \caption[ The average and standard deviation of critical parameters ]
        {\small The average and standard deviation of critical parameters: Region R4} 
        \label{fig:mean and std of nets}
        \end{minipage}
\end{figure*}

Any suggestion please?

29

Each of your \subfigures is 1\textwidth wide - there's no way LaTeX could fit two of these in a row. Also you don't need the minipage there.

Try something like this:

\documentclass{article}

\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{mwe}

\begin{document}
    \begin{figure*}
        \centering
        \begin{subfigure}[b]{0.475\textwidth}
            \centering
            \includegraphics[width=\textwidth]{Example-Image}
            \caption[Network2]%
            {{\small Network 1}}    
            \label{fig:mean and std of net14}
        \end{subfigure}
        \hfill
        \begin{subfigure}[b]{0.475\textwidth}  
            \centering 
            \includegraphics[width=\textwidth]{Example-Image}
            \caption[]%
            {{\small Network 2}}    
            \label{fig:mean and std of net24}
        \end{subfigure}
        \vskip\baselineskip
        \begin{subfigure}[b]{0.475\textwidth}   
            \centering 
            \includegraphics[width=\textwidth]{Example-Image}
            \caption[]%
            {{\small Network 3}}    
            \label{fig:mean and std of net34}
        \end{subfigure}
        \quad
        \begin{subfigure}[b]{0.475\textwidth}   
            \centering 
            \includegraphics[width=\textwidth]{Example-Image}
            \caption[]%
            {{\small Network 4}}    
            \label{fig:mean and std of net44}
        \end{subfigure}
        \caption[ The average and standard deviation of critical parameters ]
        {\small The average and standard deviation of critical parameters: Region R4} 
        \label{fig:mean and std of nets}
    \end{figure*}
\end{document}

2x2 output

Of course you would drop the \usepackage{mwe} and substitute your pictures back in at appropriate scaling.

  • Thanks, but when I am using these two packages mwe, and subcaption, I get this error: ! LaTeX Error: Can be used only in preamble.Any idea please? – Maryam Aug 15 '14 at 9:11
  • @Maryam did you try running the exact code from my example? That compiles fine for me on a clean TeXLive 2014. Otherwise do make sure all \usepackage are before \begin{document}. – greyshade Aug 15 '14 at 9:14
  • @Maryam the mwe package was only to get the sample images.. – greyshade Aug 15 '14 at 9:18
  • You don't actually need to add \usepackage{mwe} explicitly to use those images, as long as the package is installed they're available. – Torbjørn T. Aug 15 '14 at 9:20
  • It works nice, but how to use float option [H]? – Jan Filip Nov 10 '17 at 16:14
0

This also worked for me:

\begin{figure}
\begin{adjustwidth}{-8em}{0em}
  \begin{subfigure}[b]{0.7\textwidth}
    \includegraphics[width=\textwidth]{images/.png}
    \caption{}
    \label{fig:}
  \end{subfigure}
  %
  \begin{subfigure}[b]{0.7\textwidth}
    \includegraphics[width=\textwidth]{images/.png}
    \caption{}
    \label{fig:}
  \end{subfigure}
\end{adjustwidth}
\begin{adjustwidth}{-8em}{0em}
  \begin{subfigure}[b]{0.7\textwidth}
    \includegraphics[width=\textwidth]{images/.png}
    \caption{}
    \label{fig:}
  \end{subfigure}
  %
  \begin{subfigure}[b]{0.7\textwidth}
    \includegraphics[width=\textwidth]{images/.png}
    \caption{}
    \label{fig:}
  \end{subfigure}
\end{adjustwidth}
\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.