0

I want to have a large figure to plot vertically in one full page in latex, but the caption is not shown vertically, but rather horizontally.

enter image description here

My MWE:

\documentclass{book}

\usepackage[most]{tcolorbox}

% \usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[list=true]{subcaption}

\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\Huge \bfseries \sffamily}
\setcounter{lofdepth}{2}

\begin{document}
\listoffigures

\chapter{One}
\section{One}
tesing testing tesing testing tesing testing

tesing testing

tesing testing

tesing testing

tesing testing

tesing testing

\begin{figure}[!b]
        \centering
            % \includegraphics[width=\textwidth]
                \includegraphics[scale=1.6, angle=90]{example-image}
            \subcaption{$Q^{*}$ values for arm 1}
            \label{fig:arm1}
          \end{figure}
    %

\clearpage

\section{two}
 testing

\end{document}

My plot outcome is:

![enter image description here

aan
  • 2,663

1 Answers1

1

Place the figure environment in a landscape environment from the pdflscape package and remove the angle option as shown in the following example.

Side note: What's the reason for the \subcaption command? There is only one image and no corresponding \caption in the figure?

enter image description here

\documentclass{book}

\usepackage[most]{tcolorbox}

% \usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[list=true]{subcaption}

\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\Huge \bfseries \sffamily}
\setcounter{lofdepth}{2}

\usepackage{pdflscape}

\begin{document}
\listoffigures

\chapter{One}
\section{One}
tesing testing tesing testing tesing testing

tesing testing

tesing testing

tesing testing

tesing testing

tesing testing

\begin{landscape}
\begin{figure}
        \centering
                \includegraphics[scale=1.6]{example-image}
            \subcaption{$Q^{*}$ values for arm 1}
            \label{fig:arm1}
          \end{figure}
    \end{landscape}

\clearpage

\section{two}
 testing

\end{document}

If you prefer to keep the figure floating, use sidewaysfigure from the rotating package:

\documentclass{book}

\usepackage[most]{tcolorbox}

% \usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage[list=true]{subcaption}

\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\Huge \bfseries \sffamily}
\setcounter{lofdepth}{2}

\usepackage{rotating}

\begin{document}
\listoffigures

\chapter{One}
\section{One}
tesing testing tesing testing tesing testing

tesing testing

tesing testing

tesing testing

tesing testing

tesing testing



\begin{sidewaysfigure}
        \centering
                \includegraphics[scale=1.6]{example-image}
            \subcaption{$Q^{*}$ values for arm 1}
            \label{fig:arm1}
          \end{sidewaysfigure}


\section{two}
 testing

\end{document}
leandriis
  • 62,593
  • thanks. Did I make any mistake? I try copy and paste your code, and the output is horizontally image, different from your imaga. – aan Jan 04 '20 at 11:02
  • @aan: In the resulting pdf document the whole page will be rotated resulting in you seeing the image as horizontal. Alternatively, you can also try with the lscape package. If you want your image to keep floating, go for the sidewaysfigure environment from the rotating package instead. – leandriis Jan 04 '20 at 11:15
  • thanks. you are correct. Is my mistake didn't see it clearly. Thanks once again. Brillant! – aan Jan 04 '20 at 11:21
  • @leadriis, can i know am I still able to use [h!] for the figure positioning? It seemed like have a large space before the image. I understand that the image in a new page. Do you suggest using sidewaysfigure? – aan Jan 04 '20 at 11:25
  • @aan: Which package/environment to use depends on how ou want the figure to behave. If you want it to float, use sidwwaysfigure. If you don't want it to float, use landscape. – leandriis Jan 04 '20 at 11:32
  • thanks. Now i can understand. However, I found another problem. the page number is gone and those heater also missing in image page. – aan Jan 04 '20 at 11:38
  • @aan: With which package/environment combination? – leandriis Jan 04 '20 at 11:40
  • @leadriis, I am using \usepackage{fancyhdr} for page number. – aan Jan 04 '20 at 11:42
  • This seems to be a bit more complicated. Please prepare a compilable MWE and post a follow up question. – leandriis Jan 04 '20 at 11:50
  • thanks a lot. After I checked (making a MWE), I found that is my mistake, which i set the image too large until the header and page number gone. Thanks a lot for this. – aan Jan 05 '20 at 11:42
  • i had another link question with this. https://tex.stackexchange.com/questions/523007/how-can-i-maximize-the-size-of-the-image-when-i-am-using-landscape – aan Jan 05 '20 at 14:40