title: Ordering stacked bar chart by factor proportion in R
body: <p>I have a stacked bar chart providing the proportion of visa case status (certified or denied) by world region. Here is the summary table that is used for the plot, as well as the code for the plot itself: </p>
  
  <pre><code>#Summarize grouped dataframe by World Region and Case Status Coded (by number 
  of records and proportion)
  
  summ_worldreg &lt;- df_nona_worldreg %&gt;% group_by(World.Region, 
  CaseStatusCodedFactor) %&gt;% summarise(n=n()) %&gt;% mutate(proportion = n/sum(n))
  
  Output of summ_worlreg: 
  
     World.Region              CaseStatusCodedFactor     n proportion
     &lt;fct&gt;                     &lt;fct&gt;                 &lt;int&gt;      &lt;dbl&gt;
   1 Australia and New Zealand Denied                  125     0.0628
   2 Australia and New Zealand Certified              1865     0.937 
   3 Carribbean                Denied                  337     0.187 
   4 Carribbean                Certified              1467     0.813 
   5 Central America           Denied                 2423     0.238 
   6 Central America           Certified              7762     0.762 
   7 Central Asia              Denied                   31     0.0861
   8 Central Asia              Certified               329     0.914 
  
  
  #Plot 100% Stacked Bar Graph showing distribution of Case Status by World 
  Region
  
  worldreg_case_bar &lt;- ggplot(summ_worldreg, aes(x = summ_worldreg$World.Region, 
  y = summ_worldreg$proportion, fill = summ_worldreg$CaseStatusCodedFactor)) + 
  geom_bar(stat = 'identity') 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/w4MPl.png" rel="nofollow noreferrer">Image of Plot: 100% Stacked Bar Chart - Case Status by World Region</a></p>
  
  <p>I am wanting to order the factors (World Regions) in this bar chart so that the proportion of 'denied' records increases from left to right. In other words, I want the world region with the lowest proportion of 'denied' records to be on the far left and the world region with the highest proportion of 'denied' records to be on the far right.</p>
  
  <p>Any insight on how to order this bar chart would be much appreciated. Thanks! </p>