I have a simple dataframe containing three columns:
ST_CODE | VALUE | HEIGHT
... ... ...
factor continuous continuous
I want a VALUE boxplot for each ST_CODE, but I want the order on the x axis to be determined by the ascending order of HEIGHT. This is the code:
ggplot(ozone, aes(x = ST_CODE, y = VALUE)) +
geom_boxplot(notch=TRUE)
Ordering ozone inside the ggplot function by doing ozone[order(ozone$HEIGHT),]
was useless, because the order is determined by ST_CODE. What should I do?
Here's the dataset: https://www.dropbox.com/s/kf0jcv50oaa5my9/ozone_example.csv?dl=0
I have found this question, but I didn't really get it: Rearrange x axis according to a variable in ggplot