# Fit (vertically portrayed) image with the caption displayed below

So I have this code:

     \begin{figure}[H]
\centering
\includegraphics[height=\textheight, width=\textwidth]{similar_waveforms_filtered_and_cut_new}
\caption{Seiemic traces for events studied in this project with picks made at station DE02 - the closest station to the locations determined.}
\label{similar_waveforms}
\end{figure}


and I am trying to 'best fit' an image that I have rotated so that it is portrayed vertically. when I am using height=\textheight, width=\textwidth my caption appears below the footnote - is there a way to correct this? I have attached an image for reference. Many Thanks

• welcome to tex.se! you need to reduce image height for amount of caption (~ 3baselineskip). – Zarko Apr 20 at 11:44
• – John Kormylo Apr 20 at 15:08

\documentclass{article}
\usepackage[demo]{graphicx}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure}[htbp]
\centering
\includegraphics[height=\dimexpr\textheight-3\baselineskip, % <---
width=\textwidth,
keepaspectio]%
{similar_waveforms_filtered_and_cut_new}
\caption{Seiemic traces for events studied in this project with picks made at station DE02 - the closest station to the locations determined.}
\label{similar_waveforms}
\end{figure}
\end{document}


• Dear @HB, if answer solve your problem, you can accept it (by clicking on check mark at top left side of the answer ;-) – Zarko Apr 20 at 11:52
• I think it would be a good idea to add a \keepaspectio option to \includegraphics. While it doesn't make a difference for the black rectangle that's used in your answer, it's probably a good thing to have in general. – Mico Apr 20 at 12:20
• @Mico, you are right. corrected. – Zarko Apr 20 at 12:56