- library(ggplot2)
- bp <- ggplot(PlantGrowth, aes(x=group, y=weight)) + geom_boxplot()
- bp
给图表加上标题:
- bp + ggtitle("Plant growth")
- ## 用下面这行代码也可以
- # bp + labs(title="Plant growth")
-
- # 如果标题太长了,可以使用\n将它们分行
- bp + ggtitle("Plant growth with\ndifferent treatments")
-
- # 减少行距,文字加粗
- bp + ggtitle("Plant growth with\ndifferent treatments") +
- theme(plot.title = element_text(lineheight=.8, face="bold"))
以上内容转自 数析学院 ,感兴趣的同学可以访问数析学院网站查看更多的学习资源。


雷达卡





京公网安备 11010802022788号







