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


Python NonUniformImage.set_norm方法代码示例

本文整理汇总了Python中matplotlib.image.NonUniformImage.set_norm方法的典型用法代码示例。如果您正苦于以下问题:Python NonUniformImage.set_norm方法的具体用法?Python NonUniformImage.set_norm怎么用?Python NonUniformImage.set_norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.image.NonUniformImage的用法示例。


在下文中一共展示了NonUniformImage.set_norm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plot2d

# 需要导入模块: from matplotlib.image import NonUniformImage [as 别名]
# 或者: from matplotlib.image.NonUniformImage import set_norm [as 别名]
def plot2d(x, y, z, ax=None, cmap='RdGy', norm=None, **kw):
    """ Plot dataset using NonUniformImage class

    Parameters
    ----------
    x : (nx,)
    y : (ny,)
    z : (nx,nz)
        
    """
    from matplotlib.image import NonUniformImage
    if ax is None:
        fig = plt.gcf()
        ax = fig.add_subplot(111)

    xlim = (x.min(), x.max())
    ylim = (y.min(), y.max())

    im = NonUniformImage(ax,
                         interpolation='bilinear',
                         extent=xlim + ylim,
                         cmap=cmap)

    if norm is not None:
        im.set_norm(norm)

    im.set_data(x, y, z, **kw)
    ax.images.append(im)
    #plt.colorbar(im)
    ax.set_xlim(xlim)
    ax.set_ylim(ylim)

    def update(z):
        return im.set_data(x, y, z, **kw)

    return im, update
开发者ID:nbren12,项目名称:gnl,代码行数:38,代码来源:plots.py

示例2: test_nonuniformimage_setnorm

# 需要导入模块: from matplotlib.image import NonUniformImage [as 别名]
# 或者: from matplotlib.image.NonUniformImage import set_norm [as 别名]
def test_nonuniformimage_setnorm():
    ax = plt.gca()
    im = NonUniformImage(ax)
    im.set_norm(plt.Normalize())
开发者ID:4over7,项目名称:matplotlib,代码行数:6,代码来源:test_image.py

示例3: tsys_show_dynspec

# 需要导入模块: from matplotlib.image import NonUniformImage [as 别名]
# 或者: from matplotlib.image.NonUniformImage import set_norm [as 别名]
def tsys_show_dynspec(out,idx=None,ampscl=None,domedian=True,frq='linear'):
    ''' Given "standard" output of rd_tsys_multi(), possibly
        calibrated using calibration.sp_apply_cal() and/or 
        background-subtracted using calibration.sp_bg_subtract(),
        make a nice image plot of the dynamic spectrum.  The
        plot can contain multiple panels if domedian is False,
        or plot a single spectrum representing the median of
        multiple antennas.  Only linear frequency scale is supported
        at this time.
    '''
    from matplotlib.image import NonUniformImage
    from matplotlib.dates import AutoDateLocator, DateFormatter
    from matplotlib import colors
    from matplotlib.pyplot import locator_params
    from util import Time

    nant, npol, nf, nt = out['tsys'].shape
    if idx is None:
        idx_ = np.arange(nt)
    else:
        idx_ = idx
    ut = Time(out['ut_mjd'][idx_],format='mjd')
    utd = (ut.mjd - int(ut[0].mjd) + 1).astype('float')
    good = np.where(out['fghz'] > 2.0)[0]
    if frq == 'linear':
        fghz = out['fghz'][good]
    else:
        fghz = np.log10(out['fghz'][good])

    locator = AutoDateLocator(interval_multiples=True) #maxticks=7,minticks=3,
    tsys = out['tsys'][:,:,good,idx_]
    if domedian:
        medtsys = np.nanmedian(np.nanmedian(tsys,0),0)
        fig = plt.figure()
        fig.suptitle('EOVSA Total Power Data for '+ut[0].iso[:10],fontsize=14)
        # Plot X-feed
        ax = fig.add_subplot(211)
        ax.xaxis_date()
        ax.set_ylabel('Frequency [GHz]')
        ax.set_title('Median Total Power')
        extent=[utd[0],utd[-1],fghz[0],fghz[-1]]
#        extent=[ut[0],ut[-1],fghz[0],fghz[-1]]
        im = NonUniformImage(ax,extent=extent)
        if ampscl != None:
            im.set_norm(colors.Normalize(vmin=ampscl[0],vmax=ampscl[1]))
        im.set_data(utd,fghz,medtsys)
        #fig.colorbar(im,ax)
        ax.images.append(im)
        ax.set_xlim(extent[0],extent[1])
        ax.set_ylim(extent[2],extent[3])
        ax.xaxis.set_major_locator(locator)
        #ax.xaxis.set_minor_locator(MinuteLocator(interval=10))
        # Set up date formatting
        fmt = DateFormatter('%H:%M:%S')
        ax.xaxis.set_major_formatter(fmt)
        labels = (10**ax.get_yticks()).astype('str')
        for i in range(len(labels)):
            labels[i] = labels[i][:4]
        ax.set_yticklabels(labels)
        # Repeat for Y-feed
        ax = fig.add_subplot(212)
        ax.xaxis_date()
        ax.set_xlabel('Start time '+ut[0].iso[:19]+' UT')
        ax.set_title('Median of Y-poln')
        ax.set_ylabel('Frequency [GHz]')
        im = NonUniformImage(ax,extent=extent)
        if ampscl != None:
            im.set_norm(colors.Normalize(vmin=ampscl[0],vmax=ampscl[1]))
        im.set_data(utd,fghz,medytsys)
        #fig.colorbar(im,ax)
        ax.images.append(im)
        ax.set_xlim(extent[0],extent[1])
        ax.set_ylim(extent[2],extent[3])
        ax.xaxis.set_major_locator(locator)
        # Set up date formatting
        ax.xaxis.set_major_formatter(fmt)
        ax.set_yticklabels(labels)
    plt.draw()
    plt.show()
开发者ID:binchensolar,项目名称:eovsa,代码行数:81,代码来源:offline.py


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