用ggplot2绘图时,
-
theme(plot.title=element_text(hjust=0.5))
设置标题居中 -
theme(plot.margin=unit(c(下,左,上,右),"lines")
设置与边界的距离
rm(list = ls())
library(ggsci)
ggplot(iris,aes(Species,Sepal.Length,fill=Species))+
geom_boxplot()+
scale_fill_lancet()+
theme_minimal()+
theme(panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(color="gray"),
plot.title = element_text(hjust=0.5),#title居中
plot.margin = unit(c(3,3,4,4),"lines")#绘画区域与边界的距离
)+
labs(title = "iris Dataset")
参考链接:
网友评论