import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
def func(x):
return -(x-2)*(x-8)+40
x=np.linspace(0,10)
y=func(x)
fig,ax=plt.subplots()
plt.plot(x,y,‘r’,linewidth=2)
a = 2
b = 9
ax.set_xticks([a,b])
ax.set_yticks([])
ax.set_xticklabels([’ a a a’,’ b b
matplotlib函数积分图
![](https://img-home.csdnimg.cn/images/20240711042549.png)