5

I have figure that made of two subfigures, the problem is the figure is larger than my page I want to scale the whole figure to fit into my page (with caption and everything how can I do it)

\begin{figure}[tbh]
    \centering
    \begin{subfigure}[b]{1\columnwidth}
        \centering
        \includegraphics[width=1\columnwidth]{figs/fpr-selected-crop}
        \caption{$fpr$ diagram}
        \label{fig:fpr}
    \vspace{0.7cm}
    \end{subfigure}
    \begin{subfigure}[b]{1\columnwidth}
        \centering
        \includegraphics[width=1\columnwidth]{figs/tpr-selected-crop}
        \caption{$tpr$ diagram}
        \label{fig:tpr}
    \end{subfigure}
    \caption{XXXXXXXXXXXX}
    \label{fig:fpr-tpr}
\end{figure}
  • Instead of width=1\columnwidth in \includegraphics use scale=<dimension> – user11232 Oct 4 '15 at 2:38
  • 1
    @HarishKumar I want to scale whole figure not subfigure – Am1rr3zA Oct 4 '15 at 2:39
  • Use \centering\scalebox{0.8}{\begin{subfigure}....\label{fig:fpr-tpr}} – user11232 Oct 4 '15 at 2:41
  • @HarishKumar it gave me an error ! Undefined control sequence. l.1 \chapter ... – Am1rr3zA Oct 4 '15 at 2:43
  • Should the subfigures be placed siide-by-side or one above the other? – Mico Oct 4 '15 at 2:45
2

You can use adjustbox:

\documentclass[twocolumn]{article}
\usepackage[export]{adjustbox}
\usepackage{subcaption}
\begin{document}
  \begin{figure}[tbh]
    \centering
    \begin{adjustbox}{minipage=\linewidth,scale=0.3}
    \begin{subfigure}[b]{\columnwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image}
        \caption{$fpr$ diagram}
        \label{fig:fpr}
    \vspace{0.7cm}
    \end{subfigure}
    \begin{subfigure}[b]{\columnwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-a}
        \caption{$tpr$ diagram}
        \label{fig:tpr}
    \end{subfigure}
    \caption{XXXXXXXXXXXX}
    \label{fig:fpr-tpr}
    \end{adjustbox}
\end{figure}
\end{document}

enter image description here

Adjust scale value as you wish.

3

Instead of scaling the graphs twice -- first relative to the width of the textblock and second to make the entire figure fit inside the textblock -- you may want to scale the graphs directly relative to the height of the textblock. The advantage of this approach is that the font size of the captions doesn't have be shrunk.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage{subcaption}
\usepackage{showframe} % to show textblock boundaries
\begin{document}
\begin{figure}[p]
    \centering
    \begin{subfigure}[b]{\textwidth}
        \centering
        \includegraphics[height=0.42\textheight]{figs/fpr-selected-crop}
        \caption{$fpr$ diagram}
        \label{fig:fpr}
    \vspace{0.06\textheight}
    \end{subfigure}
    \begin{subfigure}[b]{\textwidth}
        \centering
        \includegraphics[height=0.42\textheight]{figs/tpr-selected-crop}
        \caption{$tpr$ diagram}
        \label{fig:tpr}
    \end{subfigure}
    \caption{XXXXXXXXXXXX}
    \label{fig:fpr-tpr}
\end{figure}
\end{document}

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.