I have some figures generated by R too tall to fit on the page. I want to include these figures but scale down the figure according to a height restriction.
<<fig=TRUE,out.height='0.7\\textheight'>>=
Unfortunately, this squishes the plot vertically.
Inspecting the generated latex code reveals that the problem lies with the fact that width=\maxwidth
is set automatically:
\begin{knitrout}\footnotesize
...
\includegraphics[width=\maxwidth,height=0.7\textheight]{figures/view_unnamed-chunk-10}
\end{knitrout}
How can I keep the width=\maxwidth
specification from appearing in the \includegraphics
statement without setting the out.width
argument in <<>>=
explicitly? In this example, fig.width==fig.height
so I could additionally set out.width='0.7\\textheight'
(and adjust accordingly for the any aspect ratio), but I would like know for the more general case.
Passing keepaspectratio=TRUE
in <<>>=
is ignored, so that doesn't seem to be an option.