\documentclass{article}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
The graph (fig. \ref{fig:mygraph1}in landscape format works fine.
<<mygraph1,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE
>>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
But when adding a caption the figure breaks
<<mygraph2,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE,
fig.cap="Caption">>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
And breaks if made into a latex figure
\begin{figure}
<<mygraph3,out.width='1\\linewidth', fig.width=11.5, fig.height=6, echo=FALSE
>>=
graph <- c(1, 7, 9, 11, 9)
plot(graph)
@
\end{figure}
\end{landscape}
\end{document}
This was seemingly answered here: knitr Rnw latex: how to obtain a figure and caption in landscape mode that's full page width
However putting the chunk within the \begin{figure} doesn't actually seem to be a solution. At least for me the figure still breaks landscape orientation. Any ideas?