R ggplot2 改变颜色

p<-ggplot(iris,aes(Petal.Length,Petal.Width,color=Species))+geom_point()
cols=c("red","green","blue")
scale_colour_manual和scale_fill_manual用法相同
更改颜色和legend lables

p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"), labels = c("four", "six", "eight"))
更改背景
p + scale_colour_manual(values = cols, breaks = c("4", "6", "8"), labels = c("four", "six", "eight"))+theme_bw()+theme(legend.title=element_blank(),panel.grid =element_blank(), panel.grid.major=element_blank())

posted on 2017-03-08 21:56  yangyzh  阅读(907)  评论(0编辑  收藏  举报