1

I want to put two images next to eachother in a two-column layout. I do this by:

\begin{figure*}[htp]
  \centering
  \subfigure[SGD classifier with modified huber loss when using the crowdsource-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness']{\includegraphics[scale=0.27]{sgd_crowdsource_dataset.eps} \label{confusion_matrix_crowdsource}}\quad
  \subfigure[SGD classifier with modified huber loss when using the hashtag-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness']{\includegraphics[scale=0.27]{sgd_hashtag_dataset.eps} \label{confusion_matrix_hashtag}}
  \caption{Confusion matrices}
\end{figure*}

This looks like this:

enter image description here

These images tend to stick in the middle and the captions only spread under the images themselves. This results in the two images taking up a lot of space. Is there a way to align these image left and spread the caption better ?


Edit:

With the subcaption package:

\begin{figure*}
\centering
\subcaptionbox{SGD classifier with modified huber loss when using the crowdsource-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness' \label{confusion_matrix_crowdsource}}
[.49\linewidth]{\includegraphics[width=0.30\textwidth, keepaspectratio]{sgd_crowdsource_dataset2.pdf}}
\subcaptionbox{SGD classifier with modified huber loss when using the hashtag-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness' \label{confusion_matrix_hashtag}}
[.49\linewidth]{\includegraphics[width=0.30\textwidth, keepaspectratio]{sgd_hashtag_dataset2.pdf}}
\caption{Confusion matrices}\label{animals}
\end{figure*}

Gives this result:

enter image description here

  • Don't use scale, but something like width=0.49\textwidth, keepaspectratio. – Claudio Fiandrino Jun 6 '14 at 8:25
  • Why not using the subcaption Package? – Mario S. E. Jun 6 '14 at 9:00
  • Following up on @MarioS.E.'s comment: The subfigure package which you appear to be using is considered deprecated (see e.g. ctan.org/pkg/subfigure), and the use of either subfig or subcaption is recommended instead. – Torbjørn T. Jun 6 '14 at 9:17
  • @MarioS.E. I tried your suggestion (see the edit). It looks better though the caption of both figures are very close together now. If I change the size the captions will stay close together, though the figures will both come closer to the middle. Any idea how to keep the captions away from eachother ? – Olivier_s_j Jun 6 '14 at 9:23
  • Adding a \hspace worked. Ok that seems to fix it. @MarioS.E. If you want you can set this as an answer and I'll accept it. – Olivier_s_j Jun 6 '14 at 9:28
0

As suggested by @Mario S. E., the subcaption package is the solution:

\begin{figure*}
\centering
\subcaptionbox{SGD classifier with modified huber loss when using the crowdsource-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness' \label{confusion_matrix_crowdsource}}
[.45\linewidth]{\includegraphics[width=0.30\textwidth, keepaspectratio]{sgd_crowdsource_dataset2.pdf}}
\hspace{20pt}
\subcaptionbox{SGD classifier with modified huber loss when using the hashtag-label-set. A=`anger', F=`fear', J=`joy', L=`love', S=`sadness', S2=`surprise', T=`thankfulness' \label{confusion_matrix_hashtag}}
[.45\linewidth]{\includegraphics[width=0.30\textwidth, keepaspectratio]{sgd_hashtag_dataset2.pdf}}
\caption{Confusion matrices}\label{animals}
\end{figure*}

In order to make sure the captions of the figures do not touch, a hspace can be added

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.