本文整理汇总了Python中matplotlib.backends.backend_agg.FigureCanvasAgg.show方法的典型用法代码示例。如果您正苦于以下问题:Python FigureCanvasAgg.show方法的具体用法?Python FigureCanvasAgg.show怎么用?Python FigureCanvasAgg.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_agg.FigureCanvasAgg
的用法示例。
在下文中一共展示了FigureCanvasAgg.show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_rmse_vs_time
# 需要导入模块: from matplotlib.backends.backend_agg import FigureCanvasAgg [as 别名]
# 或者: from matplotlib.backends.backend_agg.FigureCanvasAgg import show [as 别名]
def plot_rmse_vs_time(Ymes, Ypre, Time, Date, name):
fw, fh = 6, 6
fig = mpl.figure.Figure(figsize=(fw, fh), facecolor='white')
canvas = FigureCanvas(fig)
# ---- Create Axes
leftMargin = 0.75 / fw
rightMargin = 0.75 / fw
bottomMargin = 0.75 / fh
topMargin = 0.75 / fh
x0, y0 = leftMargin, bottomMargin
w0 = 1 - (leftMargin + rightMargin)
h0 = 1 - (bottomMargin + topMargin)
ax0 = fig.add_axes([x0, y0, w0, h0], polar=True)
# ---- Plot Data
# Estimation Error
Yerr = np.abs(Ypre - Ymes)
Time *= 2 * np.pi / 365.
c = '0.4'
ax0.plot(Time, Yerr, '.', mec=c, mfc=c, ms=15, alpha=0.5)
# RMSE Polygon
Months = Date[1]
RMSE = np.zeros(12)
mfd = np.zeros(12)
for m in range(12):
mfd[m] = (xldate_from_date_tuple((2000, m+1, 1), 0) -
xldate_from_date_tuple((2000, 1, 1), 0))
indx = np.where(Months == m+1)[0]
RMSE[m] = (np.mean(Yerr[indx] ** 2)) ** 0.5
# Transform first day of the month to radians
mfd = mfd * 2 * np.pi / 365.
# Add first point at the end to close the polygon
mfd = np.append(mfd, mfd[0])
RMSE = np.append(RMSE, RMSE[0])
ax0.plot(mfd, RMSE * 5, ls='--', c='red', lw=2, mec='b', mew=3, mfc='b',
ms=10, dash_capstyle='round', dash_joinstyle='round')
# ---- Labels
ax0.tick_params(axis='both', direction='out', labelsize=16)
ax0.set_xticklabels(['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN',
'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'])
ax0.set_xticks(mfd)
ax0.set_yticklabels([])
ax0.set_yticks([])
ax0.set_rmax(1.1 * np.max(Yerr))
# ax0.set_rgrids([10,20,30,40,50,60,70,80,90], angle=345.)
# ---- Draw
fig.savefig(name + '_polar_error.pdf')
canvas.show()