簡體   English   中英

增加 grid.arrange plot 大小

[英]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)

結果圖不可讀。

這是結果輸出。

使用高度 function 似乎只能相對於彼此調整 plot 的大小。 知道如何使每個 plot 作為一個整體更大(更長)以便每個都更具可讀性嗎?

在你的 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)

參考

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM