I\'m trying to change the order in which legend items appear. I\'ve spent about an hour at this, with no results.
Here\'s an example setup:
library(
ggplot
will usually order your factor values according to the levels()
of the factor. You are best of making sure that is the order you want otherwise you will be fighting with a lot of function in R, but you can manually change this by manipulating the color scale:
ggplot(d, aes(x = x, y = y)) +
geom_point(size=7, aes(color = a)) +
scale_color_discrete(breaks=c("1","3","10"))