001、基础绘图
ggplot(data=mtcars, aes(x=mpg, y=disp, color=factor(cyl))) + geom_point()
02、手动调整颜色
ggplot(data=mtcars, aes(x=mpg, y=disp, color=factor(cyl))) + geom_point() + scale_color_manual(values = c("red", "black", "blue")) ## 增加该句
03、使用调色板
ggplot(data=mtcars, aes(x=mpg, y=disp, color=factor(cyl))) + geom_point() + scale_color_brewer(palette = "Spectral") ## 增加该句
来源:https://www.jianshu.com/p/be3d6a03af48
标签:disp,mpg,颜色,point,color,手动,ggplot2,factor,geom From: https://www.cnblogs.com/liujiaxin2018/p/17520418.html