我遇到了一个困扰我的问题!像这样,轴标题中的上划似乎改变了绘图区域。在此处输入图像描述
您可以增加轴和轴之间的空间。title…
d <- dplyr::tibble(X=1:10,
Y=10:1)
p1 <- ggplot2::ggplot(d,ggplot2::aes(x=X,y=Y)) +
ggplot2::geom_point() +
ggplot2::xlab("test") +
ggplot2::theme(axis.title.x=ggplot2::element_text(margin=ggplot2::margin(t=10)))
p2 <- ggplot2::ggplot(d,ggplot2::aes(x=X,y=Y)) +
ggplot2::geom_point() +
ggplot2::xlab("test²") +
ggplot2::theme(axis.title.x=ggplot2::element_text(margin=ggplot2::margin(t=10)))
gridExtra::grid.arrange(p1,p2,nrow=1)