如何在matplotlib中的曲线下阴影区域

问题描述

结帐fill。这是有关填充受约束区域的示例

解决方法

我想使用matplotlib来说明两个区域之间的定积分:x_0和x_1。

给定以下图,如何在matplotlib中的曲线下的阴影区域从x = -1到x = 1着色

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))