折腾了一天,终于好了。应该是版本的问题。在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画图时标题无法居中的问题

 

相关文章:

  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-04-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-01-10
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案