title: ggplot boxplot: How to order x axis according to a third variable?
body: <p>I have a simple dataframe containing three columns:</p>
  
  <pre><code>ST_CODE    |    VALUE    |    HEIGHT
  ...             ...           ...
  factor          continuous    continuous
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>ggplot(ozone, aes(x = ST_CODE, y = VALUE)) +
      geom_boxplot(notch=TRUE)
  </code></pre>
  
  <p>Ordering ozone inside the ggplot function by doing <code>ozone[order(ozone$HEIGHT),]</code> was useless, because the order is determined by ST_CODE. What should I do?</p>
  
  <p>Here's the dataset: <a href="https://www.dropbox.com/s/kf0jcv50oaa5my9/ozone_example.csv?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/kf0jcv50oaa5my9/ozone_example.csv?dl=0</a></p>
  
  <p>I have found this question, but I didn't really get it: <a href="https://stackoverflow.com/questions/35773410/rearrange-x-axis-according-to-a-variable-in-ggplot">Rearrange x axis according to a variable in ggplot</a></p>