r 降价图总是在第二页

r markdown plot always on second page

我把markdown文件编织成word。 我有3个地块。第一个图总是放在第二页上,即使我将它调整为小。

在发生这种情况的降价脚本下方

---
title: "Melding stats rapportage"
output: word_document
---
Author: PDG  
```{r echo=FALSE, comment=NA}
d<-format(Sys.Date(), "%d-%m-%Y")
dd<- "Date:"
knitr::kable(paste(dd, d))
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```
```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```
```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```

我找到了确保图表不会从第二页开始的解决方案。 看起来,如果图形代码紧挨着放在一起,那么 Markdown 会将输出作为一个整体而不是 3 个单独的图形。 在 3 个图形代码之间画一条线使 Markdown 将 3 个图形视为单个图形,并且第一个图形很好地放在第一页上。

更正代码中的技巧:

```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```

```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```

```{r fig.width=6, fig.height=6,echo=FALSE}
library(ggplot2)
ggplot(pressure, aes(temperature, pressure)) + geom_bar(stat = "identity")
```