title: How to change the names of the x values in a boxplot
body: <p>Sorry if this is very basic, but I am quite new to this. I am creating boxplots for some survey data in R using boxplot(). I  notice it automatically arranges the x groups in alphabetical order, which doesn't suit my needs. In my data frame I changed the names to have an 'a' or 'b' at the beginning. This puts them in the order I want but then the label isn't neat. I would like to be able to override the x labels from the data frame with my own labels OR decide the order of the values along the x axis. Basically I just want 'Riparian' to come first, then 'Floodplain'. I have a number of other boxplots to do as well, some will have more than 2 values on the x axis.</p>
  
  <p>This is the data and the code without trying to override the labels</p>
  
  <p><a href="https://i.stack.imgur.com/AHVZb.jpg" rel="nofollow noreferrer">data</a></p>
  
  <p>Script</p>
  
  <pre><code>boxplot(tot_sp ~ hab, data = mydata, xlab= "Habitat Type", ylab = "Total # Species") 
  title("Bird Search: Total Species")
  </code></pre>
  
  <p>boxplot
  <a href="https://i.stack.imgur.com/1CUNB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1CUNB.jpg" alt="enter image description here"></a></p>
  
  <p>Some other scripts I have tried, none have worked.</p>
  
  <pre><code>boxplot(tot_sp ~ hab, data = mydata, axis(1, at=seq(1, 2), labels = labels.name), 
          xlab= "Habitat Type", ylab = "Total # Species") 
  
  boxplot(tot_sp ~ hab, data = mydata, 'labels',{'Riparian', 'Floodplain'}, at=NULL, 
          xlab= "Habitat Type", ylab = "Total # Species") 
  
  boxplot(tot_sp ~ hab, data = mydata, xtix = {'Riparian', 'Floodplain'}, xtixloc = [1, 2], 
          xlab= "Habitat Type", ylab = "Total # Species") 
  </code></pre>
  
  <p>Thanks very much for your help!</p>