[英]R Markdown: Change plot font size when knit to HTML?
字體大小實際上是相同的 - 字體大小的明顯變化是由所使用的 plot 設備的不同尺寸導致的:默認設備(當您在控制台中運行代碼時,繪圖顯示在 RStudio 中)與所使用的不同由針織者。 您可以通過使用塊選項調整 plot 尺寸來彌補這一點。
out.width
和out.height
尺寸。fig.width
和fig.height
設置圖形設備的尺寸。例子:
```{r, out.height=400, out.width=800, fig.width=6, fig.height=3}
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point()
```
```{r, out.height=400, out.width=800, fig.width=4.5, fig.height=2.25}
ggplot(mtcars, aes(x = mpg, y = hp)) +
geom_point()
```
您還可以通過包含以下塊來全局應用選項。
```{r, include=F}
knitr::opts_chunk$set(out.height=400, out.width=800, fig.width=6, fig.height=3)
```
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.