I had a similar problem. I found out that you can use the out.extra
parameter to provide keepaspectratio
option.
This is how it may look like:
<<out.height='0.7\\textheight',out.extra='keepaspectratio'>>=
The LaTex code then will look something like this:
\includegraphics[width=\maxwidth,height=0.7\textheight,keepaspectratio]{figure/unnamed-chunk-1-1}