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

Python numerix.arange函数代码示例

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

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



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

示例1: gen_colors

    def gen_colors(self, count):
        cmap = matplotlib.cm.get_cmap(self.colormap)
        if count == 1:
            return cmap([0.5])

        if count < 5:
            return cmap(arange(5) / float(4))[:count]

        return cmap(arange(count) / float(count - 1))
开发者ID:AMDmi3,项目名称:gem5,代码行数:9,代码来源:barchart.py


示例2: init_plot_data

 def init_plot_data(self):
     # jdh you can add a subplot directly from the fig rather than
     # the fig manager
     a = self.fig.add_subplot(111)
     self.x = numerix.arange(120.0)*2*numerix.pi/120.0
     self.x.resize((100,120))
     self.y = numerix.arange(100.0)*2*numerix.pi/100.0
     self.y.resize((120,100))
     self.y = numerix.transpose(self.y)
     z = numerix.sin(self.x) + numerix.cos(self.y)
     self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:11,代码来源:dynamic_image_wxagg.py


示例3: init_plot_data

 def init_plot_data(self):
     # jdh you can add a subplot directly from the fig rather than
     # the fig manager
     a = self.fig.add_axes([0.075,0.1,0.75,0.85])
     cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
     self.x = numerix.arange(120.0)*2*numerix.pi/120.0
     self.x.resize((100,120))
     self.y = numerix.arange(100.0)*2*numerix.pi/100.0
     self.y.resize((120,100))
     self.y = numerix.transpose(self.y)
     z = numerix.sin(self.x) + numerix.cos(self.y)
     self.im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')
     self.fig.colorbar(self.im,cax=cax,orientation='vertical')
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:13,代码来源:dynamic_image_wxagg2.py


示例4: OnInit

    def OnInit(self):
        self.timer = wx.PyTimer(self.OnTimer)
        self.numPoints = 0

        self.frame = wxmpl.PlotFrame(None, -1, 'WxMpl Stripchart Demo')
        self.frame.Show(True)

        # The data to plot
        x =  arange(0.0, 200, 0.1)
        y1 = 4*cos(2*pi*(x-1)/5.7)/(6+x) + 2*sin(2*pi*(x-1)/2.2)/(10)
        y2 = y1 + .5
        y3 = y2 + .5
        y4 = y3 + .5

        # Fetch and setup the axes
        axes = self.frame.get_figure().gca()
        axes.set_title('Stripchart Test')
        axes.set_xlabel('t')
        axes.set_ylabel('f(t)')

        # Attach the StripCharter and define its channels
        self.charter = wxmpl.StripCharter(axes)
        self.charter.setChannels([
            TestChannel('ch1', x, y1),
            TestChannel('ch2', x, y2),
            TestChannel('ch3', x, y3),
            TestChannel('ch4', x, y4)
        ])

        # Prime the pump and start the timer
        self.charter.update()
        self.timer.Start(100)
        return True
开发者ID:ednspace,项目名称:pyroLogger,代码行数:33,代码来源:stripcharting.py


示例5: createDBGraph

    def createDBGraph(self, widget):
        self.axis.clear()
        self.axis.set_xlabel('Samples (n)')
        self.axis.set_ylabel('Value (-)')
        self.axis.set_title('Another Graph (click on the columnheader to sort)')
        self.axis.grid(True)
 
        # get columns from listmodel
        age = []
        for row in self.listmodel:
            age.append(row[1])
        size = []
        for row in self.listmodel:
            size.append(row[2])
             
        # get number of rows
        N = len(age)
         
        ind = arange(N)  # the x locations for the groups
        width = 0.35       # the width of the bars
        p1 = self.axis.bar(ind, age, width, color='b')
        p2 = self.axis.bar(ind+width, size, width, color='r')
        # destroy graph if it already exists
        while True:
            try:
                self.canvas2.destroy()
                break
            except:
                print "nothing to destroy"
                break
             
        self.canvas2 = FigureCanvasGTK(self.figure) # a gtk.DrawingArea
        self.canvas2.show()
        self.grahview = self.wTree.get_widget("vbox2")
        self.grahview.pack_start(self.canvas2, True, True)
开发者ID:sauravkumar2014,项目名称:ASCEND,代码行数:35,代码来源:pygladematplotlib.py


示例6: __init__

 def __init__(self, infile, varName, rowNum):
     self.rowNum = rowNum
     self.name = varName
     self.y = infile.ReadVar(varName)
     self.x = arange(0,self.y.shape[0])
     print 'y.shape = ' + repr(self.y.shape)
     if len(self.y.shape) == 1:
         (self.mean, self.var, self.error, self.kappa) = stats.Stats(self.y)
开发者ID:majorana,项目名称:pimcplusplus,代码行数:8,代码来源:ds++.py


示例7: __init__

    def __init__(self):
        self.widgets = gtk.glade.XML('mpl_with_glade.glade')
        self.widgets.signal_autoconnect(GladeHandlers.__dict__)

        self['windowMain'].connect('destroy', lambda x: gtk.main_quit())
        self['windowMain'].move(10,10)
        self.figure = Figure(figsize=(8,6), dpi=72)
        self.axis = self.figure.add_subplot(111)
        
        t = arange(0.0,3.0,0.01)
        s = sin(2*pi*t)
        self.axis.plot(t,s)
        self.axis.set_xlabel('time (s)')
        self.axis.set_ylabel('voltage')

        self.canvas = FigureCanvas(self.figure) # a gtk.DrawingArea
        self.canvas.show()
        self.canvas.set_size_request(600, 400)
        self.canvas.set_events(
            gtk.gdk.BUTTON_PRESS_MASK      |            
            gtk.gdk.KEY_PRESS_MASK      |
            gtk.gdk.KEY_RELEASE_MASK    
            )
        self.canvas.set_flags(gtk.HAS_FOCUS|gtk.CAN_FOCUS)
        self.canvas.grab_focus()

        def keypress(widget, event):
            print 'key press'
        def buttonpress(widget, event):
            print 'button press'

        self.canvas.connect('key_press_event', keypress)
        self.canvas.connect('button_press_event', buttonpress)      

        def onselect(xmin, xmax):
            print xmin, xmax

        span = HorizontalSpanSelector(self.axis, onselect, useblit=False,
                                          rectprops=dict(alpha=0.5, facecolor='red') )


        self['vboxMain'].pack_start(self.canvas, True, True)
        self['vboxMain'].show()
        
        # below is optional if you want the navigation toolbar
        self.navToolbar = NavigationToolbar(self.canvas, self['windowMain'])
        self.navToolbar.lastDir = '/var/tmp/'
        self['vboxMain'].pack_start(self.navToolbar)
        self.navToolbar.show()

        sep = gtk.HSeparator()
        sep.show()
        self['vboxMain'].pack_start(sep, True, True)


        self['vboxMain'].reorder_child(self['buttonClickMe'],-1)
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:56,代码来源:mpl_with_glade.py


示例8: gaussian_example

def gaussian_example():
    """Create graph with 4 gaussian distributions"""

    x = nx.arange(-4, 4, 0.01)
    list_sigma = [0.2, 0.5, 1, 2]
    for sigma in list_sigma:
        y = normpdf(x, 0, sigma)  # unit normal
        p.plot(x, y, lw=2)
    p.legend(["$\sigma = %s$" % s for s in list_sigma])
    p.title("Normal Gaussian Distribution")
    p.savefig("results/gaussian.png")  # Save graph
开发者ID:Fandekasp,项目名称:reinforcement_learning_exercices,代码行数:11,代码来源:gaussian.py


示例9: pplot

def pplot(path, x, text):
    # N = float(len(x))
    x = sorted([float(item) for item in x])
    # ------------------ liberated from scipy.stats.morestats ------------------
    N = len(x)
    Ui = np.zeros(N) * 1.0
    Ui[-1] = 0.5 ** (1.0 / N)
    Ui[0] = 1 - Ui[-1]
    i = arange(2, N)
    Ui[1:-1] = (i - 0.3175) / (N + 0.365)
    y = stats.norm.ppf(Ui)
    ## -------------------------------------------------------------------------
    regressionplot(path, x, y, text, "Normal Score", pi=True)
开发者ID:hacsoc,项目名称:codegolf,代码行数:13,代码来源:single_regression.py


示例10: __init__

    def __init__(self):
        gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)

        self.set_title("MixedEmotions")
        self.set_border_width(10)
        
        self.fig = Figure(figsize=(3,1), dpi=100)
        self.ax = self.fig.add_subplot(111)
        self.x = arange(0,2*pi,0.01)           # x-array
        self.lines = self.ax.plot(self.x,sin(self.x))
        self.canvas = FigureCanvas(self.fig)
        self.add(self.canvas)      

        self.figcount = 0
        gtk.timeout_add(100, self.updatePlot)
开发者ID:BBelonder,项目名称:PyExpLabSys,代码行数:15,代码来源:example2.py


示例11: draw

    def draw(self):
        if not hasattr(self, 'subplot'):
            self.subplot = self._figure.add_subplot(111)

        theta = arange(0, 45*2*pi, 0.02)
        rad = (0.8*theta/(2*pi)+1)
        r = rad*(8 + sin(theta*7+rad/1.8))
        x = r*cos(theta)
        y = r*sin(theta)
        #Now draw it
        self.subplot.plot(x,y, '-r')
        #Set some plot attributes
        self.subplot.set_title("A polar flower (%s points)"%len(x), fontsize = 12)
        self.subplot.set_xlabel("test plot", fontsize = 8)
        self.subplot.set_xlim([-400, 400])
        self.subplot.set_ylim([-400, 400])
开发者ID:anondroid5,项目名称:Matplotlib,代码行数:16,代码来源:fig41.py


示例12: _create_plot

def _create_plot(self):
        from matplotlib.figure import Figure
        from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
        from matplotlib.numerix import arange, sin, pi

        figure = Figure(figsize=(5, 4), dpi=100)
        canvas = FigureCanvas(figure)  # a gtk.DrawingArea
        #win.add(canvas)

        axes = figure.add_subplot(111)
        x = arange(0.0, 30.0, 0.01)
        y = sin(2 * pi * x)
        line, = axes.plot(x, y)
        axes.set_title('hi mom')
        axes.grid(True)
        axes.set_xlabel('time')
        axes.set_ylabel('volts')
开发者ID:CoDe--BuStErS,项目名称:ISVOSA,代码行数:17,代码来源:agilent.py


示例13: _find_axes

    def _find_axes(self, minval, maxval):
        """
        Try to find axis tick positions that are well spaced
        """
        if minval >= maxval:
            raise ValueError, "maxval >= minval is required"

        # If there is a small differences between max and min values 
        # compared to the size of the largest of (abs(maxval), abs(minval))
        # the function 'tasteless_ticks' is used, which in common usage is rare.
        if (abs((maxval - minval)/float(max(abs(maxval),abs(minval)))) < 0.2):
            tslmajor, oppaxis, step = self._tasteless_ticks(minval, maxval, 10)
        else:
            tslmajor, oppaxis, step = self._tasteful_ticks(minval, maxval)
        min = tslmajor[0] - step
        tslminor = list(arange(min, maxval + 0.2*step, 0.2*step))
        tslminor = self._in_range(tslminor, minval, maxval)
        return oppaxis, step, tslminor, tslmajor 
开发者ID:knoboo,项目名称:knoboo,代码行数:18,代码来源:axes.py


示例14: __init__

 def __init__( self, strengthRange, ax, pos, decay_time=2 ) :
     
   n = 25
   t = arange(n)*2*pi/n
   self.disc = array([(cos(x),sin(x)) for x in t])
   self.strength = 0
   self.pos = pos
   self.offset = (279, 157)
   self.scale = 1.35
   self.max_size = 5 #0.5
   self.min_size = 0.10 #0.05
   self.size = self.min_size
   self.color = '#ff8000'
   self.decay_time = decay_time
   self.strengthRange = strengthRange
   self.t0 = 0
   v = self.disc * self.size + self.pos
   self.poly = ax.fill( v[:,0], v[:,1], self.color )
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:18,代码来源:RfsFieldGui.py


示例15: test_matplotlib

def test_matplotlib(request) :
    # Generate and plot some simple data:
    x = N.arange(0, 2*N.pi, 0.1)
    y = N.sin(x)+1

    pylab.ylim(8,0)
    pylab.plot(y,x)
    F = pylab.gcf()

    # Now check everything with the defaults:
    DPI = F.get_dpi()    
    DefaultSize = F.get_size_inches()
    F.set_size_inches( (2, 5) )
    filename = settings.MEDIA_ROOT + '/images/test1.png'
    F.savefig(filename)
     
    data = simplejson.dumps({'filename': filename})   
    
    return HttpResponse(data, mimetype="application/javascript")
开发者ID:xkenneth,项目名称:tdsurface,代码行数:19,代码来源:views.py


示例16: __init__

    def __init__(self):
        wxFrame.__init__(self, None, -1, "CanvasFrame", size=(550, 350))

        self.SetBackgroundColour(wxNamedColor("WHITE"))

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        t = arange(0.0, 3.0, 0.01)
        s = sin(2 * pi * t)

        self.axes.plot(t, s)
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wxBoxSizer(wxVERTICAL)
        self.sizer.Add(self.canvas, 1, wxLEFT | wxTOP | wxGROW)
        self.SetSizer(self.sizer)
        self.Fit()

        self.add_toolbar()  # comment this out for no toolbar
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:19,代码来源:embedding_in_wx2.py


示例17: OnInit

 def OnInit(self):
     from matplotlib.numerix import arange, sin, pi, cos
     'Create the main window and insert the custom frame'
     x = arange(0.0,3.0,0.01)
     s = sin(2*pi*x)
     c = cos(2*pi*x)
     t = sin(2*pi*x) + cos(2*pi*x)
     frame = ExtendedPlotFrame(None)
     style = {'with':'lines', 'color':'blue','line':'solid','width':2}
     style['legend'] = 'sin(x)'
     frame.insertCurve(x,s, style)
     style = {'with':'lines', 'color':'red','line':'solid','width':2}
     style['legend'] = 'cos(x)'
     frame.insertCurve(x,c, style)
     style = {'with':'lines', 'color':'black','line':'solid','width':2}
     #style['legend'] = 'sin(x)+cos(x)'
     frame.insertCurve(x,t, style)
     frame.Show(True)
     return True
开发者ID:cfarrow,项目名称:diffpy.pdfgui,代码行数:19,代码来源:extendedplotframe.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python numerix.array函数代码示例发布时间:2022-05-27
下一篇:
Python mlab.specgram函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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