I'm new to matplotlib and I'm trying to learn how to shade the area between two horizontal lines in a bar chart, and I wanna know how I can make it reach the edges. Here is an example:
import numpy as np
import matplotlib.pyplot as plt
N = 8
A = np.random.random(N)
B = np.random.random(N)
X = np.arange(N)
plt.bar(X, A, color = 'b')
plt.fill_between(X,0.4,0.6, facecolor = 'thistle', zorder = 2, alpha = 0.5)
plt.show()
This shows this: image