How to manually set colours to a categorical variables using ggplot()? [duplicate]

坚强是说给别人听的谎言 提交于 2019-11-29 18:10:42

For your first question, you need to use scale_colour_manual:

p +
  xlab("Population Ages") +
  ylab("Attending Education Institutions Count") +
  ggtitle("Attending Educational Institutions by Economic Activity Status :: INDIA 2001") +
  scale_colour_manual(values = c("Attending_Education" = "dark green", "Not_AE" = "red"))

For your second, I'm not clear what you want. Economic activity is represented as shape, not colour. So what would be the meaning of having dark green/red colours within that legend?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!