Graphics, Figures & TablesSub-captions not for all Sub-floats

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
davidfall
Posts: 14
Joined: Thu Aug 11, 2011 4:11 pm

Sub-captions not for all Sub-floats

Post by davidfall »

Hi,

Got in to trouble creating a figure containing multiple pictures/plots.
My idea was to show three photos each with one plot underneath.

Started out with:

Code: Select all

\begin{figure}[hhh]
    \begin{center}
    \vbox{
     \hbox{
        \subfloat{\includegraphics[clip=true, trim=0cm 0cm 0cm 0cm ,width=60mm, height=25mm]{photo1.jpg}}
        \subfloat{\includegraphics[clip=true, trim=0cm 0.5cm 0cm 0.5cm ,width=60mm, height=25mm]{photo2.jpg}}
        \subfloat{\includegraphics[clip=true, trim=0cm 0cm 0cm 0cm ,width=60mm, height=25mm]{photo3.jpg}}
    }
    \hbox{
        \subfloat[Subcaption 1]{\includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot1.pdf}}
        \subfloat[Subcaption 2]{\includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot2.pdf}}
        \subfloat[Subcaption 3]{\includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot3.pdf}}
    }
    }
    \end{center}
    \caption{Photos from experiments compared with plots from analyses }
    \label{whatever}
\end{figure}
Using this I ended up with the letteriung of the subcaptions d,e,f (as the first three ones refered to the photo)

Re-thinking:

Code: Select all

\begin{figure}[hhh]
    \begin{center}
    \hbox{

        \subfloat[Subcaption 1]{
        \vbox{
            \includegraphics[clip=true, trim=0cm 0cm 0cm 0cm ,width=60mm, height=25mm]{photo1.jpg}

            \includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot1.pdf}
        }
        }

        \subfloat[Subcaption 2]{
        \vbox{
        \includegraphics[clip=true, trim=0cm 0.5cm 0cm 0.5cm ,width=60mm, height=25mm]{photo2.jpg}

        \includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot2.pdf}
        }
        }

        \subfloat[Subcaption 3]{
        \vbox{
        \includegraphics[clip=true, trim=0cm 0cm 0cm 0cm ,width=60mm, height=25mm]{photo3.jpg}

        \includegraphics[clip=true,trim=7cm 8.0cm 5.5cm 8.5cm, width=60mm]{plot3.pdf}
        }
        }
        }
    \end{center}
    \caption{Photos from experiments compared with plots from analyses }
    \label{whatever}
\end{figure}
\FloatBarrier
This worked out to some extent; however, only the first pair is shown in the compiled pdf (a4 article). Is they ending up to far left? (All pictures are fitting nicely into the paper while using the first chunk of code)

My third idea is då a hbox with three subfloat-environments, eachs with a tikzpicture containing photo + plot vertically alligned... This feels a bit overworked though...

Any ideas?

Thanks in advance

/David
Last edited by davidfall on Wed Aug 24, 2011 1:19 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Re: Sub-captions not for all Sub-floats

Post by sommerfee »

First of all, please provide complete examples (and not just code snippets) so we can see what packages do you use etc., and so we can try your code out without having to build our own example document.

Second, why do you not simply omit the \subfloat command for the images where you don't want to have a caption?
davidfall
Posts: 14
Joined: Thu Aug 11, 2011 4:11 pm

Re: Sub-captions not for all Sub-floats

Post by davidfall »

I will make improvement in my future posts. Sorry for that...

And on your second suggestion. Brilliant! I'm hitting my self hard in the face. :oops:
Post Reply