I am running the code and it works
ggplot(data_df, aes(x= RR, y= PPW, col = year)) + geom_point(size = 3, alpha=0.6) Now I am trying to put the mean value of (x,y) on graph en give it another color by adding
ggplot(data_df, aes(x= RR, y= PPW, col = year))) + geom_point(size = 3, alpha=0.6) + geom_point(data=data_df, aes(x=mean(RR), y=mean(PPW)) + geom_point(color="red") It works, but the color of all points is now red
If I put color inside aes like these, the mean point get another color, and I see it also in legend
ggplot(data_df, aes(x= RR, y= PPW, col = year))) + geom_point(size = 3, alpha=0.6) + geom_point(data=data_df, aes(x=mean(RR), y=mean(PPW), color="red")) I would like to give the color manually. Is it possible?
aes()call, but still within the samegeom_point()or addshow.legend = NAto the secondgeom_point()call to remove the legend entry for the mean points.