在ggplot中是否可以显式设置面板大小(即灰色网格面板)?我想象(但找不到)有一些ggplot扩展可以使用类似 panel.width = unit(3, "in"), panel.height = unit(4, "in")
的参数。
我已经看到了关于设置整个图的大小或使用egg
包来对齐多个图的解决方案。但没有任何东西让我可以显式地设置面板的大小。
library(dplyr)
library(ggplot2)
library(tibble)
ds_mt <- mtcars %>% rownames_to_column("model")
mt_short <- ds_mt %>% arrange(nchar(model)) %>% slice(1:4)
mt_long <- ds_mt %>% arrange(-nchar(model)) %>% slice(1:4)
p_short <-
mt_short %>%
ggplot(aes(x = model, y = mpg)) +
geom_col() +
coord_flip()
p_short
ggsave
吗? - jan-glx