I want to use matplotlib to illustrate the definite integral between two regions: x_0, and x_1.
How can I shade a region under a curve in matplotlib from x=-1, to x=1 given the following plot
import numpy as np
from matplotlib import pyplot as plt
def f(t):
return t * t
t = np.arange(-4,4,1/40.)
plt.plot(t,f(t))
Check out
fill. Here’s an example on filling a constrained region.