在 RStudio 中,编译笔记本功能非常方便,但我希望能够更改默认值 给定 .R 脚本的全局图形宽度和高度。如何做到这一点?
最佳答案
根据RStudio documentation ,目前有两种可能的笔记本类型。为了达到你想要的效果,你必须选择类型knitr::spin
,它允许你改变 block 选项;请参阅knitr documentation了解详情。
在这种情况下,您只需添加一个代码块来设置 block 选项,例如
#+ setup, include=FALSE
library(knitr)
opts_chunk$set(fig.width = 5, fig.height = 10)
#' write the rest of your code
1 + 1
rnorm(10)
plot(cars)
关于html - stitch/Rstudio编译笔记本: modify default fig width,高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19274300/