绘制降水的年际变化折线图,并添加误差范围,主要用到fill_between()函数,可以去matplotlib官网查看。 import matplotlib.pyplot as plt import pandas as pd
cma = pd.read_excel(r'H:\Salween_result\2. spatialtemporal\CMA/1981-2018_CMA_annual_pre.xlsx', header=None, names=['year', 'cma_pre'], skiprows=1)
x, y = cma['year'], cma['cma_pre']
mstd = cma['cma_pre'].std() y_up_err = y + mstd y_low_err = y - mstd fig, ax = plt.subplots() ax.plot(x, y) ax.fill_between(x, y_low_err, y_up_err, color='skyblue', alpha=0.2) plt.show()