当前位置: 首页>>代码示例>>Python>>正文


Python pylab.rcParams方法代码示例

本文整理汇总了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') 
开发者ID:deepmind,项目名称:spriteworld,代码行数:24,代码来源:demo_ui.py

示例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]) 
开发者ID:yassersouri,项目名称:omgh,代码行数:7,代码来源:vis_finetune.py

示例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) 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:15,代码来源:GeospatIal Distribution DYnamics.py

示例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 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:60,代码来源:GeospatIal Distribution DYnamics.py


注:本文中的matplotlib.pylab.rcParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。