问题描述
我遇到一个困扰我很多的问题! 这样,轴标题中的上标似乎改变了绘图区域。 enter image description here
解决方法
您可以增加axis和axis之间的间距。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,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)