How to shade region under the curve in matplotlib

The final answer I came up with is to use fill_between.

I thought there would have been a simple shade between type method, but this does exactly what I want.

section = np.arange(-1, 1, 1/20.)
plt.fill_between(section,f(section))

Leave a Comment