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


Python pylab.title函数代码示例

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


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

示例1: window_fn_matrix

def window_fn_matrix(Q,N,num_remov=None,save_tag=None,lms=None):
    Q = n.matrix(Q); N = n.matrix(N)
    Ninv = uf.pseudo_inverse(N,num_remov=None) # XXX want to remove dynamically
    #print Ninv 
    info = n.dot(Q.H,n.dot(Ninv,Q))
    M = uf.pseudo_inverse(info,num_remov=num_remov)
    W = n.dot(M,info)

    if save_tag!=None:
        foo = W[0,:]
        foo = n.real(n.array(foo))
        foo.shape = (foo.shape[1]),
        print foo.shape
        p.scatter(lms[:,0],foo,c=lms[:,1],cmap=mpl.cm.PiYG,s=50)
        p.xlabel('l (color is m)')
        p.ylabel('W_0,lm')
        p.title('First Row of Window Function Matrix')
        p.colorbar()
        p.savefig('{0}/{1}_W.pdf'.format(fig_loc,save_tag))
        p.clf()

        print 'W ',W.shape
        p.imshow(n.real(W))
        p.title('Window Function Matrix')
        p.colorbar()
        p.savefig('{0}/{1}_W_im.pdf'.format(fig_loc,save_tag))
        p.clf()


    return W
开发者ID:SaulAryehKohn,项目名称:capo,代码行数:30,代码来源:Q_gsm_error_analysis.py

示例2: plotear

def plotear(xi,yi,zi):
    # mask inner circle
    interior1 = sqrt(((xi+1.5)**2) + (yi**2)) < 1.0 
    interior2 = sqrt(((xi-1.5)**2) + (yi**2)) < 1.0
    zi[interior1] = ma.masked
    zi[interior2] = ma.masked
    p.figure(figsize=(16,10))
    pyplot.jet()
    max=2.8
    min=0.4
    steps = 50
    levels=list()
    labels=list()
    for i in range(0,steps):
	levels.append(int((max-min)/steps*100*i)*0.01+min)
    for i in range(0,steps/2):
	labels.append(levels[2*i])
    CSF = p.contourf(xi,yi,zi,levels,norm=colors.LogNorm())
    CS = p.contour(xi,yi,zi,levels, format='%.3f', labelsize='18')
    p.clabel(CS,labels,inline=1,fontsize=9)
    p.title('electrostatic potential of two spherical colloids, R=lambda/3',fontsize=24)
    p.xlabel('z-coordinate (3*lambda)',fontsize=18)
    p.ylabel('radial coordinate r (3*lambda)',fontsize=18)
    # add a vertical bar with the color values
    cbar = p.colorbar(CSF,ticks=labels,format='%.3f')
    cbar.ax.set_ylabel('potential (reduced units)',fontsize=18)
    cbar.add_lines(CS)
    p.show()
开发者ID:ipbs,项目名称:ipbs,代码行数:28,代码来源:show2.py

示例3: Xtest3

    def Xtest3(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 is similar to the original test but we construct our own 
        uniform grid. This should 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 = cdms.grid.createUniformGrid(-90.0, 23, 8.0, -180.0, 36, 10.0, order="yx", mask=None)

        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,代码行数:35,代码来源:testMarvel.py

示例4: plot_stress

	def plot_stress(self, block_ids=None, fignum=0):
		block_ids = self.check_block_ids_list(block_ids)
		#
		plt.figure(fignum)
		ax1=plt.gca()
		plt.clf()
		plt.figure(fignum)
		plt.clf()
		ax0=plt.gca()

		#
		for block_id in block_ids:
			rws = numpy.core.records.fromarrays(zip(*filter(lambda x: x['block_id']==block_id, self.shear_stress_sequences)), dtype=self.shear_stress_sequences.dtype)
			stress_seq = []
			for rw in rws:
				stress_seq += [[rw['sweep_number'], rw['shear_init']]]
				stress_seq += [[rw['sweep_number'], rw['shear_final']]]
			X,Y = zip(*stress_seq)
			#
			ax0.plot(X,Y, '.-', label='block_id: %d' % block_id)
			#
			plt.figure(fignum+1)
			plt.plot(rws['sweep_number'], rws['shear_init'], '.-', label='block_id: %d' % block_id)
			plt.plot(rws['sweep_number'], rws['shear_final'], '.-', label='block_id: %d' % block_id)
			plt.figure(fignum)
		ax0.plot([min(self.shear_stress_sequences['sweep_number']), max(self.shear_stress_sequences['sweep_number'])], [0., 0.], 'k-')
		ax0.legend(loc=0, numpoints=1)
		plt.figure(fignum)
		plt.title('Block shear_stress sequences')
		plt.xlabel('sweep number')
		plt.ylabel('shear stress')
开发者ID:BKJackson,项目名称:vq,代码行数:31,代码来源:quick_look.py

示例5: showHistory

 def showHistory(self, figNum):
     pylab.figure(figNum)
     plot = pylab.plot(self.history, label = 'Test Stock')
     plot
     pylab.title('Closing Price, Test ' + str(figNum))
     pylab.xlabel('Day')
     pylab.ylabel('Price')
开发者ID:agamat,项目名称:Stock-Simulator,代码行数:7,代码来源:stock_classes.py

示例6: add_quad

    def add_quad(self, name, X, fZ):
        """
        Create a 4-panel figure
        name: title of the figure
        X: 1D axes data
        fZ: 2D data set (Fortran indexing)
        """
# Does not work on chipolata: (older matplotlib?)
#	i = 0
#	fig, axs = pylab.subplots(2,2)
#	for ax in axs.ravel():
#		pcm = ax.pcolormesh(F[i])
#		ax.axis('tight')
#		fig.colorbar(pcm,ax=ax)
#		ax.set_title(name+','+str(i))
#		i += 1

# The default ordering for 2D meshgrid is Fortran style
        title = name.replace(',', '_')
        self.figs.append((title, pylab.figure(title)))
        for i in range(4):
            fX, fY = numpy.meshgrid(X[i], X[i])
            ax = pylab.subplot('22'+str(i+1))
            pcm = ax.pcolormesh(fX, fY, fZ[i])
            ax.axis('tight')
            self.figs[-1][1].colorbar(pcm)
            pylab.title(name+','+str(i))
开发者ID:jianmingtang,项目名称:PIC-tools,代码行数:27,代码来源:draw_dist.py

示例7: plotHistogram

def plotHistogram(data, preTime):
    pylab.figure(1)
    pylab.hist(data, bins=10)
    pylab.xlabel("Virus Population At End of Simulation")
    pylab.ylabel("Number of Trials")
    pylab.title("{0} Time Steps Before Treatment Simulation".format(preTime))
    pylab.show()
开发者ID:eshilts,项目名称:intro-to-cs-6.00x,代码行数:7,代码来源:ps9.py

示例8: plotB3reg

def plotB3reg():
    w=loadStanFit('revE2B3BHreg.fit')
    printCI(w,'mmu')
    printCI(w,'mr')
    for b in range(2):
        subplot(1,2,b+1)
        plt.title('')
        px=np.array(np.linspace(-0.5,0.5,101),ndmin=2)
        a0=np.array(w['mmu'][:,b],ndmin=2).T
        a1=np.array(w['mr'][:,b],ndmin=2).T
        y=np.concatenate([sap(a0+a1*px,97.5,axis=0),sap(a0+a1*px[:,::-1],2.5,axis=0)])
        x=np.squeeze(np.concatenate([px,px[:,::-1]],axis=1))
        plt.plot(px[0,:],np.median(a0)+np.median(a1)*px[0,:],'red')
        #plt.plot([-1,1],[0.5,0.5],'grey')
        ax=plt.gca()
        ax.set_aspect(1)
        ax.add_patch(plt.Polygon(np.array([x,y]).T,alpha=0.2,fill=True,fc='red',ec='w'))
        y=np.concatenate([sap(a0+a1*px,75,axis=0),sap(a0+a1*px[:,::-1],25,axis=0)])
        ax.add_patch(plt.Polygon(np.array([x,y]).T,alpha=0.2,fill=True,fc='red',ec='w'))
        man=np.array([-0.4,-0.2,0,0.2,0.4])
        mus=[]
        for m in range(len(man)):
            mus.append(loadStanFit('revE2B3BH%d.fit'%m)['mmu'][:,b])
        mus=np.array(mus).T
        errorbar(mus,x=man)
        ax.set_xticks(man)
        plt.xlim([-0.5,0.5])
        plt.ylim([-0.4,0.8])
        #plt.xlabel('Manipulated Displacement')
        if b==0:
            plt.ylabel('Perceived Displacemet')
            plt.gca().set_yticklabels([])
        subplot_annotate()
    plt.text(-1.1,-0.6,'Pivot Displacement',fontsize=8);
开发者ID:simkovic,项目名称:wolfpackRevisited,代码行数:34,代码来源:Evaluation.py

示例9: plot_cost

    def plot_cost(self):
        if self.show_cost not in self.train_outputs[0][0]:
            raise ShowNetError("Cost function with name '%s' not defined by given convnet." % self.show_cost)
        train_errors = [o[0][self.show_cost][self.cost_idx] for o in self.train_outputs]
        test_errors = [o[0][self.show_cost][self.cost_idx] for o in self.test_outputs]

        numbatches = len(self.train_batch_range)
        test_errors = numpy.row_stack(test_errors)
        test_errors = numpy.tile(test_errors, (1, self.testing_freq))
        test_errors = list(test_errors.flatten())
        test_errors += [test_errors[-1]] * max(0,len(train_errors) - len(test_errors))
        test_errors = test_errors[:len(train_errors)]

        numepochs = len(train_errors) / float(numbatches)
        pl.figure(1)
        x = range(0, len(train_errors))
        pl.plot(x, train_errors, 'k-', label='Training set')
        pl.plot(x, test_errors, 'r-', label='Test set')
        pl.legend()
        ticklocs = range(numbatches, len(train_errors) - len(train_errors) % numbatches + 1, numbatches)
        epoch_label_gran = int(ceil(numepochs / 20.)) # aim for about 20 labels
        epoch_label_gran = int(ceil(float(epoch_label_gran) / 10) * 10) # but round to nearest 10
        ticklabels = map(lambda x: str((x[1] / numbatches)) if x[0] % epoch_label_gran == epoch_label_gran-1 else '', enumerate(ticklocs))

        pl.xticks(ticklocs, ticklabels)
        pl.xlabel('Epoch')
#        pl.ylabel(self.show_cost)
        pl.title(self.show_cost)
开发者ID:01bui,项目名称:cuda-convnet,代码行数:28,代码来源:shownet.py

示例10: evaluate_result

def evaluate_result(data, target, result):
	assert(data.shape[0] == target.shape[0])
	assert(target.shape[0] == result.shape[0])
	
	correct = np.where( result == target )
	miss 	= np.where( result != target )
	
	class_rate = float(correct[0].shape[0]) / target.shape[0]

	print "Correct classification rate:", class_rate 
	#get the 3s
	mask 			= np.where(target == wanted[0])
	data_3_correct 	= data[np.intersect1d(mask[0],correct[0])]
	data_3_miss	 	= data[np.intersect1d(mask[0],miss[0])]
	#get the 8s
	mask = np.where(target == wanted[1])
	data_8_correct 	= data[np.intersect1d(mask[0],correct[0])]
	data_8_miss	 	= data[np.intersect1d(mask[0],miss[0])]
	#plot
	plot.title("Scatter")
	plot.xlabel("x_0")
	plot.ylabel("x_1")
	size = 20
	plot.scatter(data_3_correct[:,0], data_3_correct[:,1], marker = "x", c = "r", s = size )
	plot.scatter(   data_3_miss[:,0],    data_3_miss[:,1], marker = "x", c = "b", s = size )
	plot.scatter(data_8_correct[:,0], data_8_correct[:,1], marker = "o", c = "r", s = size )
	plot.scatter(   data_8_miss[:,0],    data_8_miss[:,1], marker = "o", c = "b", s = size )
	plot.show()
开发者ID:EmCeeEs,项目名称:machine_learning,代码行数:28,代码来源:ex4.py

示例11: plot_roc

    def plot_roc(self, roc=None):
        """Plot ROC curves

        .. plot::
            :include-source:
            :width: 80%

            from dreamtools import rocs
            r = rocs.ROC()
            r.scores = [.9,.5,.6,.7,.1,.2,.6,.4,.7,.9, .2]
            r.classes = [1,0,1,0,0,1,1,0,0,1,1]
            r.plot_roc()

        """
        if roc == None:
            roc = self.get_roc()
        from pylab import plot, xlim, ylim ,grid, title, xlabel, ylabel
        x = roc['fpr']
        plot(x, roc['tpr'], '-o')
        plot([0,1], [0,1],'r')
        ylim([0, 1])
        xlim([0, 1])
        grid(True)
        title("ROC curve (AUC=%s)" % self.compute_auc(roc))
        xlabel("FPR")
        ylabel("TPR")
开发者ID:cbare,项目名称:dreamtools,代码行数:26,代码来源:rocs.py

示例12: PlotLine

def PlotLine(type):
	i=j=0
	pylab.figure(type)
	if type==0:
		pylab.title("Geomagnetism")
		pylab.xlabel("Distance")
		pylab.ylabel("Value")
	elif type==1:
		pylab.title("Compass")
		pylab.xlabel("Distance")
		pylab.ylabel("Value")
	for path in pathlist:
		f = open(path)
		f.readline()
		data = np.loadtxt(f)
		dataAfterfilter = filters.median(data,10)
		if type == 0:
			pylab.plot(dataAfterfilter,  color[i] ,label =lablelist[i])
			i=i+1
			pylab.legend()
		elif type == 1:
			pylab.plot(data[:,1],  color[i] ,label =lablelist[i])
			i=i+1
			pylab.legend()
	pass
开发者ID:ailvtu,项目名称:dataAnalysisTool,代码行数:25,代码来源:dataPlot.py

示例13: simulationWithDrug

def simulationWithDrug():

    """

    Runs simulations and plots graphs for problem 4.
    Instantiates a patient, runs a simulation for 150 timesteps, adds
    guttagonol, and runs the simulation for an additional 150 timesteps.
    total virus population vs. time and guttagonol-resistant virus population
    vs. time are plotted
    """

    maxBirthProb = .1
    clearProb = .05
    resistances = {'guttagonal': False}
    mutProb = .005

    total = [100]
    g = [0]

    badVirus = ResistantVirus(maxBirthProb, clearProb, resistances, mutProb)
    viruses = [badVirus]*total[0]
    maxPop = 1000

    Bob = Patient(viruses, maxPop)

    for i in range(150):
        Bob.update()
        gVirus = 0

        for v in Bob.viruses:
            if v.isResistantTo('guttagonal'):
                gVirus += 1

        #print "g = ", gVirus
        #print "t = ", len(Bob.viruses)
        #print
        g += [gVirus]
        total += [len(Bob.viruses)]

    Bob.addPrescription('guttagonal')

    for i in range(150):
        Bob.update()
        gVirus = 0

        for v in Bob.viruses:
            if v.isResistantTo('guttagonal'):
                gVirus += 1

        g += [gVirus]
        total += [len(Bob.viruses)]

    pylab.title("Number of Viruses with Different Resistances to Guttagonal")
    pylab.xlabel("Number of Timesteps")
    pylab.ylabel("Number of Viruses")

    pylab.plot(g, '-r', label = 'Resistant')
    pylab.plot(total, '-b', label = 'Total')
    pylab.legend(loc = 'lower right')
    pylab.show()
开发者ID:misterkautzner,项目名称:Problem_Set_8,代码行数:60,代码来源:ps8.py

示例14: plot_signal

def plot_signal(x,y,title,labelx,labley,position):
    pylab.subplot (9, 1, position)
    pylab.plot(x,y)
    pylab.title(title)
    pylab.xlabel(labelx)
    pylab.ylabel(labley)
    pylab.grid(True)
开发者ID:Anastasiavika,项目名称:Radiotech,代码行数:7,代码来源:Stolyarova_Sharikov_MSK+FM-2+FM4+FM8.py

示例15: drawPrfastscore

def drawPrfastscore(tp,fp,scr,tot,show=True):
    tp=numpy.cumsum(tp)
    fp=numpy.cumsum(fp)
    rec=tp/tot
    prec=tp/(fp+tp)
    #dif=numpy.abs(prec[1:]-rec[1:])
    dif=numpy.abs(prec[::-1]-rec[::-1])
    pos=dif.argmin()
    pos=len(dif)-pos-1
    ap=0
    for t in numpy.linspace(0,1,11):
        pr=prec[rec>=t]
        if pr.size==0:
            pr=0
        p=numpy.max(pr);
        ap=ap+p/11;
    if show:    
        pylab.plot(rec,prec,'-g')
        pylab.title("AP=%.3f EPRthr=%.3f"%(ap,scr[pos]))
        pylab.xlabel("Recall")
        pylab.ylabel("Precision")
        pylab.grid()
        pylab.show()
        pylab.draw()
    return rec,prec,scr,ap,scr[pos]
开发者ID:ChrisYang,项目名称:CRFdet,代码行数:25,代码来源:VOCpr.py


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