码迷,mamicode.com
首页 > 其他好文 > 详细

ggplot2画图时标题无法居中的问题

时间:2016-12-09 19:28:20      阅读:509      评论:0      收藏:0      [点我收藏+]

标签:gpl   car   3.3   mile   geo   版本   mobile   poi   tle   

折腾了一天,终于好了。应该是版本的问题。在R3.2.2能居中(别问我为什么知道),在R3.3.2上就不能。解决方式如下:

library(ggplot2)
ggplot(data=mtcars, aes(x=wt, y=mpg)) +
  geom_point() +
  labs(title="Automobile Data", x="Weight", y="Miles Per Gallon")+
  theme(plot.title = element_text(hjust = 0.5))  #也就加上这一行

ggplot2画图时标题无法居中的问题

标签:gpl   car   3.3   mile   geo   版本   mobile   poi   tle   

原文地址:http://www.cnblogs.com/aloiswei/p/6150480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!