Graphics, Figures & Tablestwo figures (with subfigures) side by side

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
acosgaya
Posts: 1
Joined: Thu Mar 24, 2011 4:20 pm

two figures (with subfigures) side by side

Post by acosgaya »

Hi I have two Figures that I want to put side by side, each figure has 3 subfigures. The layout I want is the following

Figure 1. Figure 2.
__________ ___________
Subfig 1.a Subfig 2.a
Subfig 1.b Subfig 2.b
Subfig 1.c Subfig 2.c


I was trying to put each Figure environment inside a minipage, but it doesn't work. I'd appreciate some help. This is what I have so far

Code: Select all

% \begin{figure}%
% Figure 1 with 3 subfigures
\begin{minipage}[c][1\width]{0.40\textwidth}%
\begin{figure}%	
 \centering
 \subfigure[Total wall clock time]{%
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/no_load/uniform1M-totalTime.eps}}\\
 \subfigure[Total relative speedup]{%
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/no_load/uniform1M-totalSpeedup.eps}}\\
 \subfigure[Query relative speedup]{%
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/uniform1MspeedupQuery.eps}}
 \caption[Speedup results on uniform data 1M points]{Results on uniform data set 1M}
\end{figure}%
\end{minipage}%
% Figure 2 with 3 subfigures
\begin{minipage}[c][1\width]{0.40\textwidth}
\begin{figure}
 \centering
 \subfigure[Total wall clock time]{%
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/no_load/uniform5M-totalTime.eps}}\\
 \subfigure[Total relative speedup]{
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/no_load/uniform5M-totalSpeedup.eps}}\\ 
 \subfigure[Query relative speedup]{
   \includegraphics[width=0.50\textwidth]
   {skyline_figs/figs/parallel/uniform5MspeedupQuery.eps}}
 \caption[Speedup results on uniform data 5M points]{Results on uniform data set 5M.}
   \label{fig:parallel-uniform-5M-array-tree}
\end{figure}
\end{minipage}
% \end{figure}%
Thanks,

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

two figures (with subfigures) side by side

Post by localghost »

Please always provided a full but minimal example that is compilable as is. Otherwise it becomes very difficult to give specific help, especially when a problem becomes more complicated.

To your problem. You can't put a float environment into another environment. It will try to float out. The example below is a very basic structure which probably needs some adjustments.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=3cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage[font=footnotesize]{subcaption}

\begin{document}
  \begin{figure}[!ht]
    \begin{minipage}{0.45\textwidth}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-1-1:dummy}
      \end{subfigure}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-1-2:dummy}
      \end{subfigure}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-1-3:dummy}
      \end{subfigure}
      \caption{First Dummy}\label{fig-1:dummy}
    \end{minipage}
    \hfill
    \begin{minipage}{0.45\textwidth}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-2-1:dummy}
      \end{subfigure}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-2-2:dummy}
      \end{subfigure}
      \begin{subfigure}{\linewidth}
        \rule{\linewidth}{0.75\linewidth}
        \caption{Sub-dummy}\label{subfig-2-3:dummy}
      \end{subfigure}
      \caption{First Dummy}\label{fig-2:dummy}
    \end{minipage}
  \end{figure}
\end{document}

Best regards and welcome to the board
Thorsten
Post Reply