title: How to to add stacked bar plot hatching in pandas? (...or how to get BarContainer vs AxisSubplot in pandas plot vs. matplotlib?)
body: <p>I have a code example using <code>matplotlib.pyplot.plot()</code> that works and that that I want to replicate to make hatched bar segments on a stacked bar chart. However, I have been making all of my other graphics using <code>pandas.DataFrame.plot()</code> instead of <code>matplotlib.pyplot.plot()</code> and would like to continue this here as well. The example code returns a tuple of <code>BarContainer</code> objects and <code>pandas.DataFrame.plot()</code> returns an <code>AxisSubplot</code> obect, and I don't know how to navigate between the two. </p>
  
  <p>Any suggestions for how to get <code>BarContainer</code> objects out of <code>pandas.DataFrame.plot()</code> so that I can use those to replicate the example? </p>
  
  <p>If not, any suggestions for how to achieve my aim of adding hatching per colored bar segment on a stacked bar chart using <code>pandas.DataFrame.plot()</code>? </p>
  
  <p>With my data, the hatching will be useful to help differentiate between similar colors since I have both a lot of categories and items and the results otherwise can look visually similar. (I know I could also find a way to plot simpler things, but doing this helpful for my exploratory data analysis.) Thank you!</p>
  
  <p><br>
  Example working code to hatch each colored bar segment of a stacked bar chart (from here: <a href="https://matplotlib.org/examples/pylab_examples/hatch_demo.html" rel="nofollow noreferrer">https://matplotlib.org/examples/pylab_examples/hatch_demo.html</a> ):</p>
  
  <pre><code>import pandas as pd
  import numpy as np  
  import matplotlib.pyplot as plt
  
  fig = plt.figure()
  ax2 = fig.add_subplot(111)
  bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \
      ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black')
  
  patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.')
  for bar, pattern in zip(bars, patterns):
      bar.set_hatch(pattern)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dNY57.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dNY57.png" alt="enter image description here"></a></p>
  
  <p><br>
  My code (with simplified data) that I wish had hatches per colored bar segments:</p>
  
  <pre><code>df = pd.DataFrame(np.random.uniform(0,10, size=(5,26)))
  df.columns=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
  ax = df.plot.barh(stacked=True, width=0.98, figsize=(10,5), cmap='gist_ncar')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WQX3G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WQX3G.png" alt="enter image description here"></a></p>