title: Order x axis categories as in the dataset
body: <p>I want to arrange the categories in the x axis of my heatmap  in the order as in the excel file's Term order. But it automatically gets arranged in alphabatic order.</p>
  <pre><code>library(ggplot2)
  library(reshape)
  getwd()
  x&lt;-read.csv(&quot;R.csv&quot;,check.names = F)
  
  y&lt;-melt(x,id=&quot;Term&quot;)
  
  ggplot(y,aes(variable, Term,fill=value))+geom_tile()+coord_flip()+
    scale_fill_manual(values = c(&quot;#FFE5CC&quot;,&quot;#FF9934&quot;),guide = guide_legend(reverse = TRUE))+                   
    theme(legend.title = element_text(color = &quot;black&quot;, size = 10),axis.title=element_blank(),
          axis.text.x = element_text(angle = 90,vjust = .5,hjust = 1,color = &quot;black&quot;,size=&quot;7&quot;),
          axis.text.y = element_text(color = &quot;black&quot;,size=&quot;12&quot;))+
    scale_x_discrete(expand=expansion(0),limits=rev) +
    scale_y_discrete(expand=expansion(0))
  </code></pre>
  <p><img src="https://i.stack.imgur.com/EL9e5.png" alt="Heatmap" /></p>
  <p><img src="https://i.stack.imgur.com/yz2JK.png" alt="csv file" /></p>