title: Reversed order after coord_flip in R
body: <p>Data example from dbv:</p>
  
  <pre><code>  gender Sektion
  1      m       5
  2      m       5
  3      w      3B
  4      w      3B
  5      w      3B
  6      m       4
  </code></pre>
  
  <p>I have the following plot:</p>
  
  <pre><code>Sekplot &lt;- ggplot(dbv,aes(x=Sektion,
                            fill=factor(gender),
                            stat="bin", 
                            label = paste(round((..count..)/sum(..count..)*100), "%"))) 
  Sekplot &lt;- Sekplot + geom_bar(position="fill")
  Sekplot &lt;- Sekplot + scale_y_continuous(labels = percent)
  Sekplot &lt;- Sekplot + labs(title = "test")
  Sekplot &lt;- Sekplot + scale_fill_discrete(name="test", breaks=c("m", "w", "k.A."), labels=c("m", "w", "k.A."))
  Sekplot &lt;- Sekplot + geom_hline(aes(yintercept = ges, linetype = "test"), colour = "black", size = 0.75, show_guide = T)
  Sekplot &lt;- last_plot() + coord_flip()
  Sekplot &lt;- Sekplot + guides(colour = guide_legend(override.aes = list(linetype = 0 )), 
                                      fill = guide_legend(override.aes = list(linetype = 0 )), 
                                      shape = guide_legend(override.aes = list(linetype = 0 )), 
                                      linetype = guide_legend()) + theme(legend.title=element_blank())
  
  Sekplot 
  </code></pre>
  
  <p>Output: Plot with y-axis in wrong order</p>
  
  <p><a href="https://i.stack.imgur.com/gMjBl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gMjBl.png" alt="Plot with y-axis in wrong order"></a></p>
  
  <p>How can I reverse the order of the "Sektion" axis? I'd like to have one on top and 8 at the bottom. </p>
  
  <p>I tried, according to <code>groupA$Date &lt;- factor(groupA$Date, levels=rev(unique(groupA$Date)))</code>:</p>
  
  <pre><code>Sekplot &lt;- last_plot() + coord_flip() + scale_x_reverse()
  </code></pre>
  
  <p>in several flavor, but couldn't find the right way.</p>