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


Python pylab.pcolor函数代码示例

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


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


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