R 画散点图

 ggplot(data=df, aes(x=n, y=rt, group=kernel, shape=kernel, colour=kernel)) + 
     geom_point(fill="white", size=3) + geom_line() + xlab("n") + ylab("Runtime (s)") + 
     opts(title=title,plot.title=theme_text(size=font.size)) + 
     scale_colour_manual(values=c("grey30", "red")) + 
     opts(legend.position = c(x_shift,0.87),legend.background=theme_rect(fill = "transparent",colour=NA))

标题居中

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))  #也就加上这一行
 
原文地址:https://www.cnblogs.com/shanyr/p/11497408.html