I plot a 2 geom_point graph with the following code:
source("http://www.openintro.org/stat/data/arbuthnot.R") library(ggplot2) ggplot() + geom_point(aes(x = year,y = boys),data=arbuthnot,colour = '#3399ff') + geom_point(aes(x = year,y = girls),data=arbuthnot,shape = 17,colour = '#ff00ff') + xlab(label = 'Year') + ylab(label = 'Rate')
I simply want to know how to add a legend on the right side. With the same shape and color. Triangle pink should have the legend "woman" and blue circle the legend "men". Seems quite simple but after many trial I could not do it. (I'm a beginner with ggplot).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With