有时候画折线图需要这种效果:
又叫shade range graph。
只需要使用plt.fill_between即可
代码:
x=[0,1,2,3,4,5,6,7]
y1=[4, 6, 7, 5, 5.5, 6, 9, 7.3]
y2=[2, 2.5, 3.9, 4, 3, 2.4, 8, 6.9]
y3=[3, 4, 6, 4.5, 4, 5, 8.5, 7]
plt.plot(x, y3)
plt.fill_between(x, y1, y2,
facecolor='green',
edgecolor='red',
alpha=0.3)