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

Python pylab.draw函数代码示例

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

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



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

示例1: run

def run():
    colors = [
        'b', 'g', 'r', 'c', 'm', 'y', 'k',
        'b--', 'g--', 'r--', 'c--', 'm--', 'y--', 'k--',
        'bo', 'go', 'ro', 'co', 'mo', 'yo', 'ko',
        'b+', 'g+', 'r+', 'c+', 'm+', 'y+', 'k+',
        'b*', 'g*', 'r*', 'c*', 'm*', 'y*', 'k*',
        'b|', 'g|', 'r|', 'c|', 'm|', 'y|', 'k|',
    ]
    plots = defaultdict(list)
    heap_size = []
    order = ['Heap change']
    manager = pylab.get_current_fig_manager()
    manager.resize(1400, 1350)
    pylab.ion()

    for entry in read_data():
        heap_size.append(entry["after"]["size_bytes"])

        pylab.subplot(2, 1, 1)
        pylab.plot(heap_size, 'r', label='Heap size')
        pylab.legend(["Heap size"], loc=2)

        pylab.subplot(2, 1, 2)
        plots["Heap change"].append(entry["change"]["size_bytes"])
        for thing in entry["change"]["details"]:
            if thing["what"] not in order:
                order.append(thing["what"])
            plots[thing["what"]].append(thing["size_bytes"])

        for what, color in zip(order, colors):
            pylab.plot(plots[what], color, label=what)
        pylab.legend(order, loc=3)
        pylab.draw()
开发者ID:creativeprogramming,项目名称:unhangout,代码行数:34,代码来源:plot_memory.py


示例2: createPlot

def createPlot(dataY, dataX, ticksX, annotations, axisY, axisX, dostep, doannotate):
    if not ticksX:
        ticksX = dataX
    
    if dostep:
        py.step(dataX, dataY, where='post', linestyle='-', label=axisY) # where=post steps after point
    else:
        py.plot(dataX, dataY, marker='o', ms=5.0, linestyle='-', label=axisY)
    
    if annotations and doannotate:
        for note, x, y in zip(annotations, dataX, dataY):
            py.annotate(note, (x, y), xytext=(2,2), xycoords='data', textcoords='offset points')

    py.xticks(np.arange(1, len(dataX)+1), ticksX, horizontalalignment='left', rotation=30)
    leg = py.legend()
    leg.draggable()
    py.xlabel(axisX)
    py.ylabel('time (s)')

    # Set X axis tick labels as rungs
    #print zip(dataX, dataY)
  
    py.draw()
    py.show()
    
    return
开发者ID:ianmsmith,项目名称:oldtimer,代码行数:26,代码来源:oldtimer.py


示例3: plotLists

def plotLists(xList, xLabel=None, eListTitle=None, eList=None, eLabel=None, fListTitle=None, fList=None, fLabel=None):
    if h2o.python_username!='kevin':
        return

    import pylab as plt
    print "xList", xList
    print "eList", eList
    print "fList", fList

    font = {'family' : 'normal',
            'weight' : 'normal',
            'size'   : 26}
    ### plt.rc('font', **font)
    plt.rcdefaults()

    if eList:
        if eListTitle:
            plt.title(eListTitle)
        plt.figure()
        plt.plot (xList, eList)
        plt.xlabel(xLabel)
        plt.ylabel(eLabel)
        plt.draw()

    if fList:
        if fListTitle:
            plt.title(fListTitle)
        plt.figure()
        plt.plot (xList, fList)
        plt.xlabel(xLabel)
        plt.ylabel(fLabel)
        plt.draw()

    if eList or fList:
        plt.show()
开发者ID:hardikk,项目名称:h2o,代码行数:35,代码来源:h2o_gbm.py


示例4: set_ticks

	def set_ticks(xmajor,ymajor,xminor,yminor):
		ax=pylab.gca()
		ax.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(xmajor))
		ax.xaxis.set_minor_locator(matplotlib.ticker.MultipleLocator(xminor))
		ax.yaxis.set_major_locator(matplotlib.ticker.MultipleLocator(ymajor))
		ax.yaxis.set_minor_locator(matplotlib.ticker.MultipleLocator(yminor))
		pylab.draw()
开发者ID:keflavich,项目名称:cluster-in-a-box,代码行数:7,代码来源:cluster_emission.py


示例5: 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


示例6: update

	def update(self):
		if self.pose != []:
			plt.figure(1)
			clf()
			self.fig1 = plt.figure(num=1, figsize=(self.window_size, \
				self.window_size), dpi=80, facecolor='w', edgecolor='w')
			title (self.title)			
			xlabel('Easting [m]')
			ylabel('Northing [m]')
			axis('equal')
			grid (True)
			poseT = zip(*self.pose)	
			pose_plt = plot(poseT[1],poseT[2],'#ff0000')

			if self.wptnav != []:
				mode = self.wptnav[-1][MODE]

				if not (self.wptnav[-1][B_E] == 0 and self.wptnav[-1][B_N] == 0 and self.wptnav[-1][A_E] == 0 and self.wptnav[-1][A_N] == 0):
					b_dot = plot(self.wptnav[-1][B_E],self.wptnav[-1][B_N],'ro',markersize=8)
					a_dot = plot(self.wptnav[-1][A_E],self.wptnav[-1][A_N],'go',markersize=8)
					ab_line = plot([self.wptnav[-1][B_E],self.wptnav[-1][A_E]],[self.wptnav[-1][B_N],self.wptnav[-1][A_N]],'g')
					target_dot = plot(self.wptnav[-1][TARGET_E],self.wptnav[-1][TARGET_N],'ro',markersize=5)

				if mode == -1:
					pose_dot = plot(self.wptnav[-1][POSE_E],self.wptnav[-1][POSE_N],'b^',markersize=8)
				elif mode == 1:
					pose_dot = plot(self.wptnav[-1][POSE_E],self.wptnav[-1][POSE_N],'bs',markersize=8)
				elif mode == 2:
					pose_dot = plot(self.wptnav[-1][POSE_E],self.wptnav[-1][POSE_N],'bo',markersize=8)

		if self.save_images:
			self.fig1.savefig ('plot_map%05d.jpg' % self.image_count)
			self.image_count += 1
		draw()
开发者ID:AliquesTomas,项目名称:FroboMind,代码行数:34,代码来源:wptnav_plot.py


示例7: run

def run(steps=10):
	for i in range(steps):
	    Q.time_step()
	    #Q.plot_links()
	    py.xlim((0,config['XSIZE']))
	    py.ylim((0,config['YSIZE']))
	    py.draw()
开发者ID:OpenSourceCancer,项目名称:cancersim,代码行数:7,代码来源:quick_test_sim.py


示例8: plot

 def plot(self):
     if not self.plot_state: return
     history = self.plot_state
     import pylab
     with self.pylab_interface:
         dream_views.plot_Med(history)
         pylab.draw()
开发者ID:RONNCC,项目名称:bumps,代码行数:7,代码来源:uncertainty_view.py


示例9: plotSpectrum

def plotSpectrum(spectrum,filename=""):
		pylab.ion() 	
		pylab.figure(0) 	
		pylab.clf() 	
		pylab.plot(spectrum)
		pylab.draw()
		pylab.savefig(filename)
开发者ID:chopley,项目名称:controlCode,代码行数:7,代码来源:roachPolSeparateNoiseDiode.py


示例10: ukViz

 def ukViz(fgi, axap, ap, axac, y):
     axap.set_xdata(ap[1,:])
     axap.set_ydata(ap[0,:])
     axac.set_xdata(y[1,:])
     axac.set_ydata(y[0,:])
     plt.draw()
     fgi.show()
开发者ID:perigee,项目名称:uk,代码行数:7,代码来源:ukf.py


示例11: gui_repr

    def gui_repr(self):
        """Generate a GUI to represent the sentence alignments
        """
        if __pylab_loaded__:
            fig_width = max(len(self.text_e), len(self.text_f)) + 1
            fig_height = 3
            pylab.figure(figsize=(fig_width*0.8, fig_height*0.8), facecolor='w')
            pylab.box(on=False)
            pylab.subplots_adjust(left=0, right=1, bottom=0, top=1)
            pylab.xlim(-1, fig_width - 1)
            pylab.ylim(0, fig_height)
            pylab.xticks([])
            pylab.yticks([])

            e = [0 for _ in xrange(len(self.text_e))]
            f = [0 for _ in xrange(len(self.text_f))]
            for (i, j) in self.align:
                e[i] = 1
                f[j] = 1
                # draw the middle line
                pylab.arrow(i, 2, j - i, -1, color='r')
            for i in xrange(len(e)):
                # draw e side line
                pylab.text(i, 2.5, self.text_e[i], ha = 'center', va = 'center',
                        rotation=30)
                if e[i] == 1:
                    pylab.arrow(i, 2.5, 0, -0.5, color='r', alpha=0.3, lw=2)
            for i in xrange(len(f)):
                # draw f side line
                 pylab.text(i, 0.5, self.text_f[i], ha = 'center', va = 'center',
                        rotation=30)
                 if f[i] == 1:
                    pylab.arrow(i, 0.5, 0, 0.5, color='r', alpha=0.3, lw=2)

            pylab.draw()
开发者ID:yochananmkp,项目名称:clir,代码行数:35,代码来源:align.py


示例12: save_plot

 def save_plot(self, filename):
     plt.ion()
     targarr = np.array(self.targvalue)
     self.posi[0].set_xdata(self.wt_positions[:,0])
     self.posi[0].set_ydata(self.wt_positions[:,1])
     while len(self.plotel)>0:
         self.plotel.pop(0).remove()
     self.plotel = self.shape_plot.plot(np.array([self.wt_positions[[i,j],0] for i, j in self.elnet_layout.keys()]).T,
                                np.array([self.wt_positions[[i,j],1]  for i, j in self.elnet_layout.keys()]).T, 'y-', linewidth=1)
     for i in range(len(self.posb)):
         self.posb[i][0].set_xdata(self.iterations)
         self.posb[i][0].set_ydata(targarr[:,i])
         self.legend.texts[i].set_text('%s = %8.2f'%(self.targname[i], targarr[-1,i]))
     self.objf_plot.set_xlim([0, self.iterations[-1]])
     self.objf_plot.set_ylim([0.5, 1.2])
     if not self.title == '':
         plt.title('%s = %8.2f'%(self.title, getattr(self, self.title)))
     plt.draw()
     #print self.iterations[-1] , ': ' + ', '.join(['%s=%6.2f'%(self.targname[i], targarr[-1,i]) for i in range(len(self.targname))])
     with open(self.result_file+'.results','a') as f:
         f.write( '%d:'%(self.inc) + ', '.join(['%s=%6.2f'%(self.targname[i], targarr[-1,i]) for i in range(len(self.targname))]) +
             '\n')
     #plt.show()
     #plt.savefig(filename)
     display(plt.gcf())
     #plt.show()
     clear_output(wait=True)
开发者ID:arne-klein,项目名称:TOPFARM,代码行数:27,代码来源:plot.py


示例13: keypress

def keypress(event):
    global pos,cb,fig,dataset,nticks,ticks,colors,cmap
    if event.key==",":
        pos -= 1
    if event.key==".":
        pos += 10
    if event.key=="a":
        nticks+=1
        ticks=[i/float(nticks) for i in range(nticks)]
        colors=[float2rgb(sqrt(i+1),mic,mxc) for i in range(len(ticks))]
    if event.key=="z":
        nticks-=1
        ticks=[i/float(nticks) for i in range(nticks)]
        colors=[float2rgb(sqrt(i+1),mic,mxc) for i in range(len(ticks))]
    pos=pos%gridsz[0]
    if pstyle==1:
        ax=logplotter(X,Y,dataset[pos,:,:],ticks,colors)
        pl.title("%d Log plot energy density, use < and > to change plots"%pos)
        #P.colorbar(ax,ticks=ticks,drawedges=True)
        cb.update_bruteforce(ax)
    elif pstyle==2:
        plotter(X,Y,dataset[pos,:,:])
        pl.title("%d Vacancy in Red, use < and > to change plots"%pos)
    elif pstyle==3:
        pl.imshow(dataset[pos,:,:],extent=[0,gridsz[0],0,gridsz[1]],cmap=cmap)
    pl.draw()
开发者ID:acadien,项目名称:matcalc,代码行数:26,代码来源:chgcarVacancy.py


示例14: PSFrange

    def PSFrange(self,junkAx):
        """
        Display function that you shouldn't call directly.
        """

        #ca=pyl.gca()
        pyl.sca(self.sp1)

        print self.starsScat

        newLim=[self.sp1.get_xlim(),self.sp1.get_ylim()]
        self.psfPlotLimits=newLim[:]
        w=num.where((self.points[:,0]>=self.psfPlotLimits[0][0])&(self.points[:,0]<=self.psfPlotLimits[0][1])&(self.points[:,1]>=self.psfPlotLimits[1][0])&(self.points[:,1]<=self.psfPlotLimits[1][1]))[0]

        if self.starsScat<>None:
            self.starsScat.remove()
            self.starsScat=None

        for ii in range(len(self.showing)):
            if self.showing[ii]: self.moffPatchList[ii][0].remove()

        for ii in range(len(self.showing)):
            if ii not in w: self.showing[ii]=0
            else: self.showing[ii]=1



        for ii in range(len(self.showing)):
            if self.showing[ii]:
                self.moffPatchList[ii]=self.sp4.plot(self.moffr,self.moffs[ii])
        self.sp4.set_xlim(0,30)
        self.sp4.set_ylim(0,1.02)

        pyl.draw()
开发者ID:Mikea1985,项目名称:trippy,代码行数:34,代码来源:psfStarChooser.py


示例15: plotSpectrum6

def plotSpectrum6(spectrum1On,spectrum2On,spectrum3On,spectrum4On,spectrum1Off,spectrum2Off,spectrum3Off,spectrum4Off,thetaL,thetaR,filename=""):
		pylab.ion() 	
		pylab.figure(0) 	
		pylab.clf() 
		pylab.grid()
		pylab.subplot(321)
		pylab.plot(spectrum1On,'r')
		pylab.plot(spectrum1Off)
		pylab.title('Channel1')
		pylab.subplot(322)
		pylab.title('Channel2')
		pylab.plot(spectrum2On,'r')
		pylab.plot(spectrum2Off)
		pylab.subplot(323)
		pylab.title('Channel3')
		pylab.plot(spectrum3On,'r')
		pylab.plot(spectrum3Off)
		pylab.subplot(324)
		pylab.title('Channel4')
		pylab.plot(spectrum4On,'r')
		pylab.plot(spectrum4Off)
		pylab.subplot(325)
		pylab.title('ThetaL')
		pylab.plot(thetaL,'r')
		pylab.subplot(326)
		pylab.title('ThetaR')
		pylab.plot(thetaR,'r')
		pylab.draw()
		pylab.savefig(filename)
开发者ID:chopley,项目名称:controlCode,代码行数:29,代码来源:roachPolSeparateNoiseDiode.py


示例16: show

    def show(self, lenmavlist, block=True):
        """show graph"""
        if self.labels is not None:
            labels = self.labels.split(",")
            if len(labels) != len(fields) * lenmavlist:
                print(
                    "Number of labels (%u) must match number of fields (%u)" % (len(labels), len(fields) * lenmavlist)
                )
                return
        else:
            labels = None

        for fi in range(0, lenmavlist):
            timeshift = 0
            for i in range(0, len(self.x)):
                if self.first_only[i] and fi != 0:
                    self.x[i] = []
                    self.y[i] = []
            if labels:
                lab = labels[fi * len(self.fields) : (fi + 1) * len(self.fields)]
            else:
                lab = self.fields[:]
            if self.multi:
                col = colors[:]
            else:
                col = colors[fi * len(self.fields) :]
            self.plotit(self.x, self.y, lab, colors=col)
            for i in range(0, len(self.x)):
                self.x[i] = []
                self.y[i] = []

        pylab.draw()
        pylab.show(block=block)
开发者ID:stephendade,项目名称:MAVProxy,代码行数:33,代码来源:grapher.py


示例17: test_path

def test_path():
  "generate and draw a random path"
  path = genpath()
  P.ion()
  P.clf()
  draw_path(P.gca(), path)
  P.draw()
开发者ID:a-rahimi,项目名称:sqp-control,代码行数:7,代码来源:sim.py


示例18: dovis

    def dovis(self):
        """
        Do runtime visualization. 
        """

        pylab.clf()

        phi = self.cc_data.get_var("phi")

        myg = self.cc_data.grid

        pylab.imshow(numpy.transpose(phi[myg.ilo:myg.ihi+1,
                                         myg.jlo:myg.jhi+1]), 
                     interpolation="nearest", origin="lower",
                     extent=[myg.xmin, myg.xmax, myg.ymin, myg.ymax])

        pylab.xlabel("x")
        pylab.ylabel("y")
        pylab.title("phi")

        pylab.colorbar()
        
        pylab.figtext(0.05,0.0125, "t = %10.5f" % self.cc_data.t)

        pylab.draw()
开发者ID:LingboTang,项目名称:pyro2,代码行数:25,代码来源:simulation.py


示例19: click

 def click(event):
     print [event.key]
     if event.key == 'm':
         mode = raw_input('Enter new mode: ')
         for k in plots:
             try:
                 d = data_mode(plt_data[k], mode)
                 plots[k].set_data(d)
             except(ValueError):
                 print 'Unrecognized plot mode'
         p.draw()
     elif event.key == 'd':
         max = raw_input('Enter new max: ')
         try: max = float(max)
         except(ValueError): max = None
         drng = raw_input('Enter new drng: ')
         try: drng = float(drng)
         except(ValueError): drng = None
         for k in plots:
             _max,_drng = max, drng
             if _max is None or _drng is None:
                 d = plots[k].get_array()
                 if _max is None: _max = d.max()
                 if _drng is None: _drng = _max - d.min()
             plots[k].set_clim(vmin=_max-_drng, vmax=_max)
         print 'Replotting...'
         p.draw()
开发者ID:carinacheng,项目名称:capo,代码行数:27,代码来源:plot_uv_zaki.py


示例20: tracks_movie

def tracks_movie(base, skip=1, frames=500, size=10):
    """
    A movie of each particle as a point
    """
    conf, track, pegs = load(base)

    fig = pl.figure(figsize=(size,size*conf['top']/conf['wall']))
    plot = None

    for t in xrange(1,max(frames, track.shape[1]/skip)):
        tmp = track[:,t*skip,:]
        if not ((tmp[:,0] > 0) & (tmp[:,1] > 0) & (tmp[:,0] < conf['wall']) & (tmp[:,1] < conf['top'])).any():
            continue

        if plot is None:
            plot = pl.plot(tmp[:,0], tmp[:,1], 'k,', alpha=1.0, ms=0.1)[0]
            pl.xticks([])
            pl.yticks([])
            pl.xlim(0,conf['wall'])
            pl.ylim(0,conf['top'])
            pl.tight_layout()
        else:
            plot.set_xdata(tmp[:,0])
            plot.set_ydata(tmp[:,1])
        pl.draw()
        pl.savefig(base+'-movie-%05d.png' % (t-1))
开发者ID:mattbierbaum,项目名称:plinko,代码行数:26,代码来源:plotting.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pylab.errorbar函数代码示例发布时间:2022-05-25
下一篇:
Python pylab.dot函数代码示例发布时间: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