Change order of groups in weighted geom_density

1.6k views Asked by At

Given the following example I would like to rearrange the densities by size, so that the biggest area (the group of "ideal") is in the back and the smallest area (the group of "fair") is in the front. This would facilitate the interpretation especially if the areas vary considerably in size.

ggplot(diamonds, aes(depth, fill = cut, colour = cut, weight=price)) +
  geom_density(alpha = 0.5) +
  xlim(55, 70)

enter image description here

0

There are 0 answers