我正在使用patchwork
包安排多个情节。其中一个图的文本垂直排列,这将 x 轴标签向下推(应该如此),但是当我与第二个图结合时,两个图中的 x 轴标签都向下移动。我想将第二个图的 x 轴标签保持在其原始位置。用一个例子更容易解释:
library(ggplot2)
library(patchwork)
# Toy data
mtcars2 <- mtcars[1:5, ]
mtcars2$mod <- row.names(mtcars2)
# make 2 plots
p1 <- ggplot(mtcars2, aes(mod, mpg)) +
geom_col() +
theme(axis.text.x = element_text(angle = 90, vjust = 0, hjust = 1))
p2 <- ggplot(mtcars2, aes(hp, disp)) +
geom_point()
# arrange plots next to each other
p1 + p2
但我想要:
这可能吗?我没有被束缚patchwork
,我尝试过gridExtra::grid.arrange()
,但改变了情节的大小。