Stuck colored filled area in bar chart, python
Question: everyone,

I want to create a bar chart but with a filled background.

For example: for 0 to 1 in y axis the background must be black for >1 to <2 in
y axis the background must be red.

In other words, i want to create bar plot with background different colored
categories in yy axis

(i sorry, my rep points dont allow me to upload a pic) Ty

**It might be closed but i think someone will find this useful: Horizontal
Colored Areas**

    
    
    import matplotlib.pylab as plt
    plt.axhspan(0, 1, facecolor='0.5', alpha=0.5,color ='b',linewidth = True,label ="Category 1")
    plt.axhspan(0, -0.8, facecolor='0.5', alpha=0.5,color ='yellow',linewidth = True,label ="Category 2")
    plt.axhspan(-0.8, -1.3, facecolor='0.5', alpha=0.5,color ='orange',linewidth = True,label ="Category 3")
    plt.axhspan(-1.3, -1.6, facecolor='0.5', alpha=0.5,color = 'orangered',linewidth = True,label ="Category 4")
    plt.axhspan(-1.6, -2, facecolor='0.5', alpha=0.5,color ='red',linewidth = True,label ="Category 5")
    plt.axhspan(-2, -3, facecolor='0.5', alpha=0.5,color ='maroon',linewidth = True,label ="Category 6")
    plt.xlabel("Categories")
    plt.ylabel("Units")
    plt.legend(loc='upper center', bbox_to_anchor=(0.5, -0.05),
              fancybox=False, shadow=False, ncol=8)
    plt.show()
    


Answer: Like this?

    
    
    fig, ax = plt.subplots(1, 1)
    
    ax.bar([0, 1, 2], [1, 2, 3], color='b', align='center')
    ax.axvspan(0, 1, color='k', alpha=.75, zorder=-1)
    ax.axvspan(1, 2, color='r', alpha=.75, zorder=-1)
    ax.set_ylim([0, 5])
    ax.set_xlabel('fake x')
    ax.set_ylabel('fake y')
    

![enter image description here](http://i.stack.imgur.com/MPgG5.png)

