1

I have 6 figures and I want to plot them under a same caption with different labels. I have tried two codes for plotting but they are not working.

Codes:

\begin{figure}[htp]
  \centering
    \includegraphics[width=30mm]{C:/Thesis/Latex/thesis_1(1)/Figures/25_for.jpeg} \\
  \subfloat b)    \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/28_for.jpeg} \\
     \subfloat c)   \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/29_for.jpeg} \\
  \subfloat d)    \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/31_for.jpeg} \\
     \subfloat e)    \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/32_for.jpeg} \\
  \subfloat f)    \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/ob_for.jpeg} \\
    \rule{35em}{0.3pt}
 \caption{Patterns of Wireless sensor networks with respect to the MetoSwiss Forecasts for $2007-09-30$}
    \label{fig: pattern30}
\end{figure}

and :

\begin{figure}[htp]
  \centering
  \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/25_for.jpeg}
  \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/28_for.jpeg}
  \\
  \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/29_for.jpeg}
   \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/31_for.jpeg}
    \\
     \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/32_for.jpeg} 
   \includegraphics[width=80mm]{C:/Thesis/Latex/thesis_1(1)/Figures/ob_for.jpeg}
        \rule{35em}{0.3pt}
    \caption{Patterns of Wireless sensor networks with respect to the MetoSwiss Forecasts for $2007-09-30$}
    \label{fig: pattern29}
\end{figure}
David Carlisle
  • 757,742
user1885733
  • 187
  • 5

2 Answers2

2

Another option is with subfig package:

\documentclass{article}
\usepackage[demo]{graphicx} %5 Remove demo in your file
\usepackage{subfig}
\graphicspath{{C:/Thesis/Latex/thesis_1(1)/Figures/}}

\begin{document}

\begin{figure}[htp]
        \centering
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{25_for}.jpg}
        \label{fig:sub1}
        }%
        \hfill
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{28_for}.jpg}
        \label{fig:sub2}
        }\\
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{29_for}.jpg}
        \label{fig:sub3}
        }%
        \hfill
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{31_for}.jpg}
        \label{fig:sub4}
        }\\
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{32_for}.jpg}
        \label{fig:sub5}
        }%
        \hfill
        \subfloat[]{%
        \includegraphics[width=.48\textwidth]{{ob_for}.jpg}
        \label{fig:sub6}
        }
        \caption{Patterns of Wireless sensor networks with respect to the MetoSwiss Forecasts for $2007-09-30$}
    \label{fig:pattern29}
\end{figure}

\end{document}

enter image description here

As a side note, it is not good to use underscore in figure file name. If needed try replacing them with hyphens (-) like 25-for.jpeg. As discovered by the Op, the problem was with the extension .jpeg instead of .jpg

David Carlisle
  • 757,742
1

I would use the subcaption and its subfigure environment for this.

Also, rather than specifying the complete directory path each time, you can simply use

\graphicspath{{C:/Thesis/Latex/thesis_1(1)/Figures/}}

as detailed in the graphicx documentation.

If that directory only contains .jpeg files, then there's no need to use the extension on the images.

To get the images in the code below, remove the demo option from the graphicx, i.e, just \usepackage{graphicx}

Complete MWE:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\graphicspath{{C:/Thesis/Latex/thesis_1(1)/Figures/}}

\begin{document}

\begin{figure}[htp]
    \centering
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{25_for.jpeg}
        \caption{}
    \end{subfigure}%
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{28_for.jpeg}
        \caption{}
    \end{subfigure}%
    \\
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{29_for.jpeg}
        \caption{}
    \end{subfigure}%
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{31_for.jpeg}
        \caption{}
    \end{subfigure}
    \\
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{32_for.jpeg} 
        \caption{}
    \end{subfigure}%
    \begin{subfigure}{80mm}
        \includegraphics[width=\textwidth]{ob_for.jpeg}
        \caption{}
    \end{subfigure}%
    \caption{Patterns of Wireless sensor networks with respect to the MetoSwiss Forecasts for $2007-09-30$}
    \label{fig:pattern29}
\end{figure}

\end{document}
David Carlisle
  • 757,742
cmhughes
  • 100,947