• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pylab.pcolor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pylab.pcolor函数的典型用法代码示例。如果您正苦于以下问题:Python pcolor函数的具体用法?Python pcolor怎么用?Python pcolor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: heat_map

def heat_map(K, show, name):
	pl.pcolor(K)
	pl.colorbar()
	pl.title(name)
	pl.savefig(name)
	if show == True:
		pl.show()
开发者ID:izabelcavassim,项目名称:Project-in-Bioinformatics,代码行数:7,代码来源:Kinship_nod_genes.py


示例2: correlation_matrix

def correlation_matrix(data, size=8.0):
    """ Calculates and shows the correlation matrix of the pandas data frame
        'data' as a heat map.
        Only the correlations between numerical variables are calculated!
    """
    # calculate the correlation matrix
    corr = data.corr()
    #print corr
    lc = len(corr.columns)
    # set some settings for plottin'
    pl.pcolor(corr, vmin = -1, vmax = 1, edgecolor = "black")
    pl.colorbar()
    pl.xlim([-5,lc])
    pl.ylim([0,lc+5])
    pl.axis('off')
    # anotate the rows and columns with their corresponding variables
    ax = pl.gca()            
    for i in range(0,lc):
        ax.annotate(corr.columns[i], (-0.5, i+0.5), \
            size='large', horizontalalignment='right', verticalalignment='center')
        ax.annotate(corr.columns[i], (i+0.5, lc+0.5),\
            size='large', rotation='vertical',\
            horizontalalignment='center', verticalalignment='right')
    # change the size of the image
    fig = pl.figure(num=1)    
    fig.set_size_inches(size+(size/4), size)     
    
    pl.show()
开发者ID:ThomasvanHeyningen,项目名称:BestMLGroup2,代码行数:28,代码来源:ExploringData.py


示例3: Xtest2

    def Xtest2(self):
        """
        Test from Kate Marvel
        As the following code snippet demonstrates, regridding a
        cdms2.tvariable.TransientVariable instance using regridTool='regrid2' 
        results in a new array that is masked everywhere.  regridTool='esmf' 
        and regridTool='libcf' both work as expected.

        This passes.
        """
        import cdms2 as cdms
        import numpy as np

        filename = cdat_info.get_sampledata_path() + '/clt.nc'
        a=cdms.open(filename)
        data=a('clt')[0,...]

        print data.mask #verify this data is not masked

        GRID= data.getGrid() # input = output grid, passes

        test_data=data.regrid(GRID,regridTool='regrid2')

        # check that the mask does not extend everywhere...
        self.assertNotEqual(test_data.mask.sum(), test_data.size)
        
        if PLOT:
            pylab.subplot(2, 1, 1)
            pylab.pcolor(data[...])
            pylab.title('data')
            pylab.subplot(2, 1, 2)
            pylab.pcolor(test_data[...])
            pylab.title('test_data (interpolated data)')
            pylab.show()
开发者ID:UV-CDAT,项目名称:uvcdat,代码行数:34,代码来源:testMarvel.py


示例4: __call__

    def __call__(self, n):
        if len(self.f.shape) == 3:
            # f = f[x,v,t], 2 dim in phase space
            ft = self.f[n,:,:]
            pylab.pcolor(self.X, self.V, ft.T, cmap='jet')
            pylab.colorbar()
            pylab.clim(0,0.38) # for Landau test case
            pylab.grid()
            pylab.axis([self.xmin, self.xmax, self.ymin, self.ymax])
            pylab.xlabel('$x$', fontsize = 18)
            pylab.ylabel('$v$', fontsize = 18)
            pylab.title('$N_x$ = %d, $N_v$ = %d, $t$ = %2.1f' % (self.x.N, self.v.N, self.it*self.t.width))
            pylab.savefig(self.path + self.filename)
            pylab.clf()
            return None

        if len(self.f.shape) == 2:
            # f = f[x], 1 dim in phase space
            ft = self.f[n,:]
            pylab.plot(self.x.gridvalues,ft,'ob')
            pylab.grid()
            pylab.axis([self.xmin, self.xmax, self.ymin, self.ymax])
            pylab.xlabel('$x$', fontsize = 18)
            pylab.ylabel('$f(x)$', fontsize = 18)
            pylab.savefig(self.path + self.filename)
            return None
开发者ID:dsirajud,项目名称:IPython-notebooks,代码行数:26,代码来源:plots.py


示例5: updateColorTable

    def updateColorTable(self, cItem):
        print "now viz!"+str(cItem.row())+","+str(cItem.column())

        row = cItem.row()
        col = cItem.column()

        pl.clf()
        #pl.ion()
        x = pl.arange(self.dataDimen+1)
        y = pl.arange(self.dataDimen+1)
        X, Y = pl.meshgrid(x, y)
        pl.subplot(1,2,1)
        pl.pcolor(X, Y, self.mWx[row*self.dataMaxRange+col])
        pl.gca().set_aspect('equal')
        pl.colorbar()
        pl.gray()
        pl.title("user 1")

        pl.subplot(1,2,2)
        pl.pcolor(X, Y, self.mWy[row*self.dataMaxRange+col])
        pl.gca().set_aspect('equal')
        pl.colorbar()
        pl.gray()
        pl.title("user 2")
        #pl.tight_layout()

        pl.draw()
        #pl.show()
        pl.show(block=False) 
开发者ID:cvpapero,项目名称:rqt_cca,代码行数:29,代码来源:cca_interface2.py


示例6: figurepoimsimple_small

def figurepoimsimple_small(poim, l, start, savefile, show):
    R = poim

    py.figure(figsize=(14, 12))
    motivelen = int(np.log(len(poim)) / np.log(4))
    ylabel = []
    for i in range(int(math.pow(4, motivelen))):
        label = []
        index = i
        for j in range(motivelen):
            label.append(index % 4)
            index = int(index / 4)
        label.reverse()
        ylabel.append(veclisttodna(label))
    py.pcolor(R[:, start:start + l])
    cb=py.colorbar()
    for t in cb.ax.get_yticklabels():
     t.set_fontsize(40)   
    diff = int((l / 5)) - 1
    x_places = py.arange(0.5, l, diff)
    xa = np.arange(start, start + l, diff)
    diff = int((l / 4)) 
    x_places = py.arange(0.5, l , diff)
    xa = np.arange(start + 1, start + 1 + l, diff)
    py.xlabel("Position", fontsize=46)
    py.ylabel("Motif", fontsize=46)
    py.yticks(np.arange(math.pow(4, motivelen)) + 0.5, (ylabel),fontsize=40)   
    py.xticks(x_places, (xa.tolist()),fontsize=40)
    if savefile != "":
        py.savefig(savefile)  
    print "the poim should show up here"
    if show:
        py.show()
开发者ID:mcvidomi,项目名称:poim2motif,代码行数:33,代码来源:view.py


示例7: main

def main(argv=None):
    if argv is None:
        argv = sys.argv
    from pylab import pcolor, show

    pcolor(FlowNetwork().fs()[0])
    show()
开发者ID:jackdreilly,项目名称:adjoint-admm,代码行数:7,代码来源:flow.py


示例8: VisualizeColorMaps

def VisualizeColorMaps(CombinedMat, NormalizedPrunedDepMat, 
    PrunedSemanticSimMat, OntologySimilarityMat, PrunedLabels):

    '''   
    #plt.grid(True)
    #plt.subplots_adjust(bottom=0.50)
    plt.pcolor(NormalizedPrunedDepMat)
    plt.colorbar(use_gridspec=True) #to resize to the tight layout format
    plt.yticks(numpy.arange(0.5,len(CombinedMat) + 0.5),PrunedLabels)
    plt.xticks(numpy.arange(0.5,len(CombinedMat)+0.5),PrunedLabels, rotation=30,ha='right') 
    #in prev line: ha = horizontal alignment - right is used to make label terminate the the center of the grid
    plt.title("NormalizedPrunedDepMat",fontsize=20,verticalalignment='bottom')
    plt.tight_layout() #to resize so that all labels are visible
    #plt.savefig('foo.pdf',figsize=(4,4),dpi=600) # to save image as pdf, fig size may or maynot be used
    plt.show()
    

    plt.pcolor(PrunedSemanticSimMat)
    plt.colorbar(use_gridspec=True)
    plt.yticks(numpy.arange(0.5,len(CombinedMat) + 0.5),PrunedLabels)
    plt.xticks(numpy.arange(0.5,len(CombinedMat) + 0.5),PrunedLabels, rotation=45,ha='right')
    plt.title("PrunedSemanticSimMat",fontsize=20,verticalalignment='bottom')
    plt.tight_layout()
    plt.show()
    '''
    
    plt.pcolor(OntologySimilarityMat)
    plt.colorbar(use_gridspec=True)
    plt.yticks(numpy.arange(0.5,len(CombinedMat) + 0.5),PrunedLabels)
    plt.xticks(numpy.arange(0.5,len(CombinedMat) + 0.5),PrunedLabels, rotation=45,ha='right')
    plt.title("OntologySimilarityMat",fontsize=20,verticalalignment='bottom')
    plt.xlabel('Packages')
    plt.ylabel('Packages')
    plt.tight_layout()
    plt.show()
开发者ID:MLDroid,项目名称:AppSplitBenchmarkSOA,代码行数:35,代码来源:ApClusterer.py


示例9: pcAddition

def pcAddition(MOVIE=True):
    #BP S1
    out=[]
    for vp in [1,0]:
        path=inpath+'vp%03d/E%d/'%(vp+1,97)
        coeff=np.load(path+'X/coeff.npy')
        pc1=_getPC(coeff,0)
        if pc1.mean()>=0.4: pc1=1-pc1
        pc2=_getPC(coeff,1)
        if pc2.mean()>=0.4: pc2=1-pc2
        out.append([])
        out[-1].append(pc1)
        out[-1].append(pc2)
        out[-1].append((pc1-pc2+1)/2.)
        #out[-1].append((pc1+pc2)/2.)
        if False:
            out.append([])
            out[-1].append(pc1)
            out[-1].append(1-pc2)
            out[-1].append((pc1+pc2)/2.)
    if MOVIE:
        plotGifGrid(out,fn=figpath+'Pixel/pcAddition'+FMT,bcgclr=1,snapshot=2,
                plottime=True,text=[['A',20,12,-10],['B',20,84,-10]])
    bla
    print out[0][0].shape
    cols=5;fs=np.linspace(0,out[0][0].shape[0]-1,cols)
    ps=np.arange(out[0][0].shape[1])
    for i in range(len(out)):
        for j in range(len(out[0])):
            for fi in range(cols):
                plt.subplot(3,cols,j*cols+fi+1)
                plt.pcolor(ps,ps,out[i][j][fs[fi],:,:],cmap='gray')
                #plt.grid()
    plt.savefig(figpath+'Pixel'+os.path.sep+'pcAddition',
                dpi=DPI,bbox_inches='tight')
开发者ID:simkovic,项目名称:Chase,代码行数:35,代码来源:FiguresMoviesTables.py


示例10: som_plot_mapping

def som_plot_mapping(distance_map):
    bone()
    pcolor(distance_map.T) # plotting the distance map as background
    colorbar()
    #axis([0,som.weights.shape[0],0,som.weights.shape[1]])
    ion()
    show() # show the figure
开发者ID:cilliand,项目名称:textFlowAnalysis,代码行数:7,代码来源:som_plot.py


示例11: testeps

def testeps(d):
    M.clf()
    M.pcolor(d)
    M.axis('tight')
    M.colorbar()
    M.gcf().set_size_inches((7.5,6.))
    M.savefig('test.png',dpi=240)
开发者ID:astrofanlee,项目名称:project_TL,代码行数:7,代码来源:distrib.py


示例12: show

 def show( self, maxIdx=None, indices=None):
     print( 'Exemplar projection')
     som = self.som
     if maxIdx == None:
         maxIdx = len(self.data)            
     if indices ==None:            
         data= self.data[0:maxIdx]
         target = self.target
     else:
         data= self.data[indices]
         target= self.target[indices]
         
     bone()
     pcolor(som.distance_map().T) # plotting the distance map as background
     colorbar()
     t = zeros(len(target),dtype=int)
     t[target == 'A'] = 0
     t[target == 'B'] = 1
     # use different colors and markers for each label
     markers = ['o','s','D']
     colors = ['r','g','b']
     for cnt,xx in enumerate(data):
         w = som.winner(xx) # getting the winner
         # palce a marker on the winning position for the sample xx
         plot(w[0]+.5,w[1]+.5,markers[t[cnt]],markerfacecolor='None',
             markeredgecolor=colors[t[cnt]],markersize=12,markeredgewidth=2)
     axis([0,som.weights.shape[0],0,som.weights.shape[1]])
     show() # show the figure
开发者ID:sriveravi,项目名称:som,代码行数:28,代码来源:minisom.py


示例13: plot_time_course

 def plot_time_course(self, data, mode='boolean', fontsize=16):
     # TODO sort columnsi alphabetically
     # FIXME: twiny labels are slightly shifted
     # TODO flip 
     if mode == 'boolean':
         cm = pylab.get_cmap('gray')
         pylab.clf() 
         data = pd.DataFrame(data).fillna(0.5)
         pylab.pcolor(data, cmap=cm, vmin=0, vmax=1, 
             shading='faceted')
         pylab.colorbar()
         ax1 = pylab.gca()
         ax1.set_xticks([])
         Ndata = len(data.columns)
         ax1.set_xlim(0, Ndata)
         ax = pylab.twiny()
         ax.set_xticks(pylab.linspace(0.5, Ndata+0.5, Ndata ))
         ax.set_xticklabels(data.columns, fontsize=fontsize, rotation=90)
         times = list(data.index)
         Ntimes = len(times)
         ax1.set_yticks([x+0.5 for x in times])
         ax1.set_yticklabels(times[::-1],  
                 fontsize=fontsize)
         pylab.sca(ax1)
     else:
         print('not implemented')
开发者ID:cellnopt,项目名称:cellnopt,代码行数:26,代码来源:simulator.py


示例14: plot

    def plot(self):
        """
        
        .. plot::
            :include-source:
            :width: 80%
            
            from cellnopt.simulate import *
            from cellnopt.core import *
            pkn = cnodata("PKN-ToyPB.sif")
            midas = cnodata("MD-ToyPB.csv")
            s = boolean.BooleanSimulator(CNOGraph(pkn, midas))
            s.simulate(30)
            s.plot()
        """
        
        pylab.clf()

        data = numpy.array([self.data[x] for x in self.species if x in self.species])
        data = data.transpose()
        data = 1 - pylab.flipud(data)

        pylab.pcolor(data, vmin=0, vmax=1, edgecolors="k")
        pylab.xlabel("species"); 
        pylab.ylabel("Time (tick)");
        pylab.gray()

        pylab.xticks([0.5+x for x in range(0,30)], self.species, rotation=90)

        pylab.ylim([0, self.tick])
        pylab.xlim([0, len(self.species)])
开发者ID:cellnopt,项目名称:cellnopt,代码行数:31,代码来源:simulator.py


示例15: elo_grid_search

def elo_grid_search(data, run=False):
    alphas = np.arange(0.4, 2, 0.2)
    betas = np.arange(0.02, 0.2, 0.02)

    results = pd.DataFrame(columns=alphas, index=betas, dtype=float)
    plt.figure()
    for alpha in alphas:
        for beta in betas:

            model = EloModel(alpha=alpha, beta=beta)
            # model = EloTreeModel(alpha=alpha, beta=beta, clusters=utils.get_maps("data/"), local_update_boost=0.5)
            if run:
                Runner(data, model).run()
                report = Evaluator(data, model).evaluate()
            else:
                report = Evaluator(data, model).get_report()
            # results[alpha][beta] = report["brier"]["reliability"]
            results[alpha][beta] = report["rmse"]
    plt.title(data)

    cmap = plt.cm.get_cmap("gray")
    cmap.set_gamma(0.5)
    plt.pcolor(results, cmap=cmap)
    plt.yticks(np.arange(0.5, len(results.index), 1), results.index)
    plt.ylabel("betas")
    plt.xticks(np.arange(0.5, len(results.columns), 1), results.columns)
    plt.xlabel("alphas")
    plt.colorbar()
开发者ID:thran,项目名称:experiments,代码行数:28,代码来源:runner.py


示例16: plot_covar

def plot_covar(del_bl=8.,beam_sig=0.09,save_covar=True):
    covar,fqs = construct_covar(del_bl=del_bl,beam_sig=beam_sig)
    #print covar 
    p.pcolor(fqs,fqs,covar)
    p.colorbar()
    p.savefig('{0}/mc_spec_figs/{1}_covar.pdf'.format(fig_loc,save_tag_base))
    if save_covar: n.savez_compressed('{0}/monte_carlo/spectrum_data/{1}_covar'.format(data_loc,save_tag_base),covar=covar,fqs=fqs)
开发者ID:SaulAryehKohn,项目名称:capo,代码行数:7,代码来源:monte_carlo_analysis.py


示例17: plotAVTable

def plotAVTable(experiment):
    pylab.figure()
    pylab.gray()
    pylab.pcolor(experiment.agent.module.params.reshape(81,4).max(1).reshape(9,9),
            shading='faceted')
    pylab.title("Action-Value table, %s, Run %d" %
            (experiment.agent.learner.__class__.__name__, experiment.stepid))
开发者ID:bgrant,项目名称:portfolio,代码行数:7,代码来源:td.py


示例18: plotContour

def plotContour(X,Y,u,nx,ny,impsi,L,H):

	pl.pcolor(X, Y, np.transpose(u), cmap='RdBu')
	pl.colorbar()
	pl.title("u-velocity contour")
	pl.axis([X.min(), X.max(), Y.min(), Y.max()])		
	pl.show()
开发者ID:hamsteri15,项目名称:ownCodes,代码行数:7,代码来源:flat_plate.py


示例19: pcolor

    def pcolor(self, mode="mean", vmin=None, vmax=None):
        """

        If you loaded the pickle data sets with only mean and sigma, the D and
        pvalue mode cannot be used.

        """
        from pylab import clf, xticks, yticks, pcolor, colorbar, flipud, log10
        if mode == "mean":
            data = self.get_mean()
        elif mode == "sigma":
            data = self.get_sigma()
        elif mode == "D":
            data = self.get_ks()[0]
        elif mode == "pvalue":
            data = self.get_ks()[1]
        clf();

        if mode == "pvalue":
            pcolor(log10(flipud(data)), vmin=vmin, vmax=vmax);
        else:
            pcolor(flipud(data), vmin=vmin,vmax=vmax);

        colorbar()
        xticks([x+0.5 for x in range(0,8)], self.ligands, rotation=90)
        cellLines = self.cellLines[:]
        cellLines.reverse()
        yticks([x+0.5 for x in range(0,4)], cellLines, rotation=0)
开发者ID:nagyistoce,项目名称:dreamtools,代码行数:28,代码来源:sc1a_tools.py


示例20: plot2d_spectre

def plot2d_spectre(tags, freq, resistivity=False,added_resistivity=0,filter_id=False,id_start=0,id_stop=0,add_name=''):
    curves = models.CurveDB.objects.filter_tag(tags).filter_param("center_freq",value=freq)
    additional_name = ''
    if resistivity == True:
        curves = curves.filter_param('Added Resistivity ',value=added_resistivity)
        additional_name = '_R'+str(added_resistivity)+'Ohm'
    if filter_id == True :
        curves = curves.filter(id__gt=id_start-1).filter(id__lt=id_stop+1)
    a=[]
    X=[]
    Y=[]
    for curve in curves:
        a.append(np.power(10,curve.data.values/20)*float(curve.params["calibration"]))
        Y.append(float(curve.params["offset"]))
        X=array(curve.data.index, dtype=float)
    tuple = [(i,j) for i, j in zip(Y,a)]
    tuple.sort()
    Y = [val[0] for val in tuple]
    a = [val[1] for val in tuple]
    X = array(X) 
    a=array(a)
    Y=array(Y)
    pylab.close()
    pylab.pcolor(X,Y,np.log(abs(a)))
    pylab.title("Mechancial_response_electrode"+tags.replace('/','_'))
    pylab.ylabel('Offset (K)')
    pylab.xlabel('Frequency (Hz)')                                                                                                                                                                                              
    pylab.legend()
    pylab.savefig('thermal_frequency_shift'+str(freq)+tags.replace('/','_')+ additional_name+add_name+'.png')
    b=np.asarray([a,X,Y])
    np.savetxt('thermal_frequency_shift'+str(freq)+"Hz_amplitude"+tags.replace('/','_')+ additional_name+ add_name +".csv",a,delimiter=",")    
    np.savetxt('thermal_frequency_shift'+str(freq)+"Hz_frequency"+tags.replace('/','_')+ additional_name+ add_name +".csv",X,delimiter=",")
开发者ID:tjzhaomengyi,项目名称:pyinstruments,代码行数:32,代码来源:script_electrostat_NA.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pylab.pcolormesh函数代码示例发布时间:2022-05-25
下一篇:
Python pylab.pause函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap