y = np.array([1, 0, 0, -1])
y1width = -1
y2width = 3
y1 = y + y1width
y2 = y + y2width
fig = plt.figure()
ax = fig.add_subplot(111)
plt.plot(x, y, 'k', x, y1, 'k', x, y2, 'k', linewidth=2)
ax.fill_between(x, y1, y, color='g')
ax.fill_between(x, y2, y, color='r')
plt.xlim(-1, 4)
plt.ylim(-3, 6)
plt.show()
How to draw "two directions widths line" in matplotlib