本文整理汇总了Python中matplotlib.pylab.rcParams方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.rcParams方法的具体用法?Python pylab.rcParams怎么用?Python pylab.rcParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.pylab
的用法示例。
在下文中一共展示了pylab.rcParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_callbacks
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import rcParams [as 别名]
def _setup_callbacks(self):
"""Default callbacks for the UI."""
# Pressing escape should stop the UI
def _onkeypress(event):
if event.key == 'escape':
# Stop UI
logging.info('Pressed escape, stopping UI.')
plt.close(self._fig)
sys.exit()
self._fig.canvas.mpl_connect('key_release_event', _onkeypress)
# Disable default keyboard shortcuts
for key in ('keymap.fullscreen', 'keymap.home', 'keymap.back',
'keymap.forward', 'keymap.pan', 'keymap.zoom', 'keymap.save',
'keymap.quit', 'keymap.grid', 'keymap.yscale', 'keymap.xscale',
'keymap.all_axes'):
plt.rcParams[key] = ''
# Disable logging of some matplotlib events
log.getLogger('matplotlib').setLevel('WARNING')
示例2: disp_results
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import rcParams [as 别名]
def disp_results(fig, ax1, ax2, loss_iterations, losses, accuracy_iterations, accuracies, accuracies_iteration_checkpoints_ind, color_ind=0):
modula = len(plt.rcParams['axes.color_cycle'])
ax1.plot(loss_iterations, losses, color=plt.rcParams['axes.color_cycle'][(color_ind * 2 + 0) % modula])
ax2.plot(accuracy_iterations, accuracies, plt.rcParams['axes.color_cycle'][(color_ind * 2 + 1) % modula])
ax2.plot(accuracy_iterations[accuracies_iteration_checkpoints_ind], accuracies[accuracies_iteration_checkpoints_ind], 'o', color=plt.rcParams['axes.color_cycle'][(color_ind * 2 + 1) % modula])
示例3: showGpd_zipPolygon
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import rcParams [as 别名]
def showGpd_zipPolygon(dataFpDic):
zip_codes= gpd.read_file(dataFpDic["zip_codes"])
print("-"*50)
print(zip_codes.columns)
print(zip_codes.head())
# base = world.plot(color='white', figsize=(20,10))
plt.rcParams.update({'font.size': 10})
ax=zip_codes.plot(figsize=(20,20))
plt.title("zip_codes")
zip_codes.apply(lambda x: ax.annotate(s=x.zip, xy=x.geometry.centroid.coords[0], ha='center'),axis=1)
#Discrete Markov Chains (DMC)
示例4: quantiles_MoranI_Plot
# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import rcParams [as 别名]
def quantiles_MoranI_Plot(data_df,zipPolygon):
caseWeekly_unstack=data_df['CasesWeekly'].unstack(level=0)
zip_codes= gpd.read_file(zipPolygon)
data_df_zipGPD=zip_codes.merge(caseWeekly_unstack,left_on='zip', right_on=caseWeekly_unstack.index)
# print(data_df_zipGPD.head())
# print(data_df_zipGPD.describe())
print(data_df_zipGPD.columns)
weeks=idx_weekNumber=data_df.index.get_level_values('Week Number')
weeks=np.unique(weeks)
nrows=2
ncols=math.ceil(len(weeks)/nrows)
fig, axes = plt.subplots(nrows=nrows, ncols=ncols,figsize = (30,15))
for i in range(nrows):
for j in range(ncols):
# print("_"*50)
# print(str(weeks[i*ncols+j]))
try:
plt.rcParams.update({'font.size': 5})
ax = axes[i,j]
data_df_zipGPD.plot(ax=ax, column=weeks[i*ncols+j], cmap='OrRd', scheme='quantiles', legend=True,)
ax.set_title('daily cases %s Quintiles'%weeks[i*ncols+j])
ax.axis('off')
leg = ax.get_legend()
leg.set_bbox_to_anchor((0.8, 0.15, 0.16, 0.2))
data_df_zipGPD.apply(lambda x: ax.annotate(s=x.zip, xy=x.geometry.centroid.coords[0], ha='center'),axis=1)
leg = ax.get_legend()
leg.set_bbox_to_anchor((0., 0., 0.2, 0.2))
except:
pass
plt.tight_layout()
W=ps.lib.weights.Queen(data_df_zipGPD.geometry)
W.transform = 'R'
valArray=data_df_zipGPD[weeks].to_numpy()
valArray_fillNan=bfill(valArray).T
valArray_fillNan[np.isnan(valArray_fillNan)]=0
# print(valArray_fillNan,valArray_fillNan.shape)
mits=[Moran(cs,W) for cs in valArray_fillNan]
res = np.array([(mi.I, mi.EI, mi.seI_norm, mi.sim[974]) for mi in mits])
# print(res)
fig, ax = plt.subplots(nrows=1, ncols=1,figsize = (10,5) )
ax.plot(weeks, res[:,0], label='Moran\'s I')
#plot(years, res[:,1], label='E[I]')
ax.plot(weeks, res[:,1]+1.96*res[:,2], label='Upper bound',linestyle='dashed')
ax.plot(weeks, res[:,1]-1.96*res[:,2], label='Lower bound',linestyle='dashed')
ax.set_title("Global spatial autocorrelation for Covid-19-cases",fontdict={'fontsize':15})
# ax.set_xlim(weeks)
# plt.axhline(y=0, color='gray', linestyle='--',)
ax.legend()
#Moran's I >0表示空间正相关性,其值越大,空间相关性越明显,Moran's I <0表示空间负相关性,其值越小,空间差异越大,否则,Moran's I = 0,空间呈随机性。
#spatial markov about the explanation ref:蒲英霞,马荣华,葛莹,黄杏元.基于空间马尔可夫链的江苏区域趋同时空演变[J]. 地理学报.2005-09-23
#ref:https://pysal.org/pysal/generated/pysal.explore.giddy.markov.Spatial_Markov.html