title: Arbitrarily re-ordering histogram columns in R
body: <p>I would like to know how I can re-order the columns of a histogram in a way that makes sense to my data. This example illustrates what I'm trying to do.</p>
  
  <p>I have this data in a file:</p>
  
  <pre><code>blue    low
  blue    medium
  blue    high
  blue    high
  blue    high
  blue    medium
  green   low
  green   low
  green   low
  green   high
  pink    low
  pink    high
  pink    medium
  pink    low
  pink    high
  red     high
  red     low
  red     low
  red     low
  red     medium
  red     medium
  red     medium
  </code></pre>
  
  <p>If I run these commands:</p>
  
  <pre><code>colours &lt;- read.table("colours.txt", sep="\t")
  library(lattice)
  histogram(~ V2 | V1, data=colours,  type="count")
  </code></pre>
  
  <p>I get pretty much what I want except that the columns in the histograms are sorted alphabetically, high, low, medium and
  I would like to have them sorted in the more natural way low, medium, high.</p>
  
  <p>Thanks very much in advance for any pointers on how to accomplish this.</p>