Reasons that ggplot2 legend does not appear [duplicate]

colour= XYZ should be inside the aes(),not outside:

geom_point(aes(data, colour=XYZ)) #------>legend

geom_point(aes(data),colour=XYZ)  #------>no legend

Hope it helps, it took me a hell long way to figure out.

Leave a Comment