Change the size of ggplot2 plot in Sweave without making the text/numbers disproportionately large

怎甘沉沦 提交于 2019-12-01 01:37:30

It's basically a Sweave FAQ. Google and you will find a gazillion hits.

One approach is to just write the file to pdf (no scaling) and to then scale on the \includegraphics command. I just looked at a vignette I finished a couple of days ago where I wanted something approximately as wide as the page and I did:

\begin{figure}[t!]
  \centering
<<someLabel,fig=TRUE,width=8>>=
## some R code omitted
print(dotplot(foo ~ bar | someFactor, group=someThing, 
              data=someDF, layout=c(1,3),
              xlab="some X label", ylab="",
              key=simpleKey(text=c("A","B"), space="top")))
@
  \caption{Some caption.}
  \label{fig:someLabel}
\end{figure}

some basically just one width dimension at the Sweave options level. I found that small values do not work well -- so try something bigger as eg 6 or 7 inches.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!