更新时间:2021-08-24 03:11:08
您可以使用 theme()
中的 plot.margin
调整绘图边距,然后移动轴标签和标题与 element_text()
的 vjust
参数.例如:
You can adjust the plot margins with plot.margin
in theme()
and then move your axis labels and title with the vjust
argument of element_text()
. For example :
library(ggplot2)
library(grid)
qplot(rnorm(100)) +
ggtitle("Title") +
theme(axis.title.x=element_text(vjust=-2)) +
theme(axis.title.y=element_text(angle=90, vjust=-0.5)) +
theme(plot.title=element_text(size=15, vjust=3)) +
theme(plot.margin = unit(c(1,1,1,1), "cm"))
会给你这样的东西:
如果您想了解有关不同 theme()
参数及其参数的更多信息,只需在 R 提示符下输入 ?theme
即可.
If you want more informations about the different theme()
parameters and their arguments, you can just enter ?theme
at the R prompt.