增加 grid.arrange 地块大小

Increase grid.arrange plot size

我正在使用 grid.arrange 将以下三个图叠加显示。

p1 <- ggseasonplot(ng2) + labs(title = "Natural Gas Consumption from Jan. 2001 to Nov. 2021 - Seasonal Plot", x = "Month", y = "Cubic Feet (Millions)") + scale_y_continuous(labels = unit_format(unit = "M", scale = 1e-6))
p2 <- ggsubseriesplot(ng2) + labs(title = "Natural Gas Consumption from Jan. 2001 to Nov. 2021 - Subseries Plot", x = "Month", y = "Cubic Feet (Millions)") + scale_y_continuous(labels = unit_format(unit = "M", scale = 1e-6))
p3 <- ggAcf(ng2, lag.max = 36) + labs(title = "Natural Gas Consumption from Jan. 2001 to Nov. 2021 - ACF Plot", x = "Lag", y = "Correlation") 

gridExtra::grid.arrange(p1, p2, p3, nrow = 3, ncol = 1)

生成的图不可读。

使用高度函数似乎只能调整相对于彼此的地块大小。知道如何使每个图作为一个整体更大(更长)以便每个图更具可读性吗?

在您的 markdown/knitr 块中,尝试使用 fig.height = 10

这样的值
```{r, fig.height = 10}
# Small fig.width
ggplot(cars, aes(speed, dist)) + geom_point()
```

或者您可以为 Rmd 文件中的所有图形设置默认高度

knitr::opts_chunk$set(fig.height = 10)

参考资料