I have this code:
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm, showframe]{geometry}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage[skip=0.33\baselineskip]{caption}
\captionsetup[figure]{
font=bf,
size=normalsize,
justification=centerlast,
}
\usepackage[labelformat=simple]{subcaption}
\captionsetup[subfigure]{
font=normal,
size=normalsize,
justification=centerlast,
}
\renewcommand*{\thesubfigure}{Panel \thefigure\Alph{subfigure}:}
\newcommand{\plotheight}{0.425}
\newcommand{\plotwidth}{1.45}
\begin{document}
\begin{figure}[ht]
\centering
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=\plotwidth\linewidth, height=\plotheight\textheight]{monkey.jpg}
\caption{Monkey 1}
\end{subfigure}\\
\centering
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[width=\plotwidth\linewidth, height=\plotheight\textheight]{monkey.jpg}
\caption{Monkey 2}
\end{subfigure}
\vspace{2ex}
\caption{Monkey Plot}
\parbox{\linewidth}{\small{This figure contains an image of the same monkey twice.}\vspace{2ex}}
\end{figure}
\end{document}
which produces this output:
When the width of the images are less than or equal to 1, both images are centred. However, when I insert a width value larger than 1, then the images are skewed to the right, as shown in the picture.
I do get a warning from LaTeX that the images are too wide. Although, the images seems to fit perfectly fine if centred.
Does anyone have an idea what the problem is?
Thanks in advance!
Edit: the real images I am using in my report are vector based, hence they will not be distorted. But thanks to those pointing that out.
\plotwidth\linewidth
in the first place, where\plotwidth
is larger than 1? Also the way you are setting height and width may distort the image, you might want to only set one of either height or width, or also addkeepaspectratio
.