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}
  • Closed, as it was just a format problem, as commented by the OP below. – Stefan Kottwitz Jan 16 '13 at 19:07
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

  • The problem was with the format, it should be .jpg – user1885733 Jan 16 '13 at 1:59
  • 1
    @user1885733 Oh. I overlooked it as it was demo for us. :-) I only suspected that it has something to do with file name. – user11232 Jan 16 '13 at 2:11
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}
  • Again, no plots are presented – user1885733 Jan 16 '13 at 1:36
  • @user1885733 have you removed the demo option? can you update your question with more details of the output that you are getting- what error messages do you get? – cmhughes Jan 16 '13 at 1:40

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