subfigure in latex not in right position

122 views Asked by At

I use subfigure and \hfill to set two subfigures next to each other, I want figure (d,e) become next to each other and figure (f,g) next to each other in the same line. But they are not in the same line. This my latex code:

  \begin{figure*}[ht] 

   \subfigure[]{\includegraphics[height=0.45in]{figures/ch3Ex2Picture1a.png}  }
  \label{fig1b}
  \hfill

  \subfigure[]{\includegraphics [height=0.45in]{figures/ch3Ex2Picture1b.png}}
  \label{fig1c} 
  \hfill

  \subfigure[]{\includegraphics[height=1.2in]{figures/ch3Ex2Picture1c.png}  }             \hfill
  \label{fig1d} 


 
\subfigure[]{\includegraphics[height=.8in]{figures/ch3Ex2Picture2.png}}
       \label{fig1a}
    
   \hfill

  \subfigure[]{
    \includegraphics[height=.8in]{figures/ch3Ex2Picture3.png}} 
       \label{fig1e}
     
          



    \subfigure[]{
    \includegraphics[height=.88in]{figures/ch3Ex2Picture4.png}}
      \label{fig1a}
       
              \hfill
 \subfigure[]{
    \includegraphics[height=.88in]{figures/ch3Ex2Picture5.png}}    
       \label{fig1e}
    \caption{Illustration examples}
  \label{Ex2fig3}  

 \end{figure*}

code here

1

There are 1 answers

0
Ralf Ulrich On

This should look more like this, note the use of \textwidth, the placement of the labels and also the line-breaks:

\begin{figure*}[ht]
  \centering
  \subfigure[\label{line1a}]{\includegraphics[width=\textwidth*0.3]{figures/line1a.png}}
  \hfill 
  \subfigure[\label{line1b}]{\includegraphics[width=\textwidth*0.3]{figures/line1b.png}}
  \hfill 
  \subfigure[\label{line1c}]{\includegraphics[width=\textwidth*0.3]{figures/line1c.png}}
  \\  % next line
  \subfigure[\label{line2a}]{\includegraphics[width=\textwidth*0.45]{figures/line2a.png}}
  \hfill 
  \subfigure[\label{line2b}]{\includegraphics[width=\textwidth*0.45]{figures/line2b.png}}
\end{figure*}

I would also in almost all cases use the \centering and play with the numbers to improve the layout. The most important and obvious thing is to use width and not height for horizontal placement.