title: Python - Create a single horizontal stacked bar chart from Pandas data?
body: <p>I'm looking to create a single horizontal stacked bar chart as an alternative to a pie chart to show percentages. </p>
  
  <p>I'm pretty sure plot.barh will do the job (it creates multiple stacked bars in another piece of code I have). But here it doesn't stack the bars. How do I fix it?</p>
  
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  
  data=pd.DataFrame(data={"R1":["Yes","Yes","Yes","No","No"]})
  freq = data["R1"].value_counts(normalize=True)*100
  fig,ax = plt.subplots()
  freq.plot.barh(ax=ax,stacked=True)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GDpTo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDpTo.png" alt="enter image description here"></a></p>