I would like to adjust my legend (ggplot2) in such a way that the upper value in the legend corresponds to the highest end value. For example:
Blue line ends on a value of 200, which is the highest, i want the blue color to be the top color in the legend.
When orange line has second biggest endvalue in the graph i want that color to be second in the legend. And so on...
I have tried to do it manually with:
scale_color_discrete(labels = c(.....)
But still those don't give me the right format.
Is there a way to let R do this for me?
So for this picture i would like to have the legend as follows: - Red - Blue - Green
Since the ending values are in that order.
scale_color_discrete(labels = c("Apple", "Banana", "Pear"))
This code works for setting the order of the legend, but in my own graph the manually labelled items don't correspond with the order in the graph.