RMarkdown 有没有办法强制 R 代码和它生成的图形出现在同一页面上?我正在使用 Knit pdf。例如,
```{r}
ggplot(df, aes(x = x, y = y, col = sex_f)) + geom_point() +
ggtitle("Data from Children") +
labs(x = "Age (months)", y = "Height (cms)", col = "Child Gender") +
geom_smooth(method = "lm", se = FALSE) +
facet_grid(sex_f ~ town_f)
```
(不可重现)在一页上生成代码,在下一页上生成绘图。例如,我尝试过全局设置图形宽度和高度
```{r global_options, include=FALSE}
knitr::opts_chunk$set(fig.width = 4, fig.height = 3,
fig.path = 'Intro_Figs/',
fig.show = 'asis',
fig.align = 'center',
warning = FALSE, message = FALSE)
```
具有非常小的值,但这并不能防止所有错误的分页符。谢谢。