import numpy as np
import matplotlib.pyplot as plt
#数据准备
y = np.random.normal(3,2.5, size=(12,))#生成随机数
y_std = np.std(y)#求标准差
x =range(len(y))#生成x坐标#画图
plt.plot(data)
plt.fill_between
import numpy as np
import matplotlib.pyplot as plt
#数据准备
y = np.random.normal(3,2.5, size=(12,))#生成随机数
y_std = np.std(y)#求标准差
x =range(len(y))#生成x坐标
y1 = np.asarray(y)-0.5*np.asarray(y_std)#下线
y2 = np.asarray(y)+0.5*np.asarray(y_std)#上线#画图
plt.plot(x,y,color='r')
plt.fill_between(x,y1,y2,color='r',alpha=0.3)