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


Python pylab.axes函数代码示例

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


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

示例1: _example_matplotlib_plot

def _example_matplotlib_plot():
    import pylab
    from pylab import arange, pi, sin, cos, sqrt

    # Generate data
    x = arange(-2 * pi, 2 * pi, 0.01)
    y1 = sin(x)
    y2 = cos(x)

    # Plot data
    pylab.ioff()
    # print 'Plotting data'
    pylab.figure(1)
    pylab.clf()
    # print 'Setting axes'
    pylab.axes([0.125, 0.2, 0.95 - 0.125, 0.95 - 0.2])
    # print 'Plotting'
    pylab.plot(x, y1, "g:", label="sin(x)")
    pylab.plot(x, y2, "-b", label="cos(x)")
    # print 'Labelling'
    pylab.xlabel("x (radians)")
    pylab.ylabel("y")
    pylab.legend()
    print "Saving to fig1.eps"
    pylab.savefig("fig1.eps")
    pylab.ion()
开发者ID:JohnReid,项目名称:biopsy,代码行数:26,代码来源:_matplotlib.py

示例2: newFigLayer

 def newFigLayer():
     pylab.clf()
     pylab.figure(figsize=(8, 8))
     pylab.axes([0.15, 0.15, 0.8, 0.81])
     pylab.axis([0.6, -0.4, -0.4, 0.6])
     pylab.xlabel(r"$\Delta$\textsf{RA from Sgr A* (arcsec)}")
     pylab.ylabel(r"$\Delta$\textsf{Dec. from Sgr A* (arcsec)}")
开发者ID:AtomyChan,项目名称:JLU-python-code,代码行数:7,代码来源:central_HD.py

示例3: create_pie_chart

    def create_pie_chart(self, snapshot, filename=''):
        """
        Create a pie chart that depicts the distribution of the allocated
        memory for a given `snapshot`. The chart is saved to `filename`.
        """
        try:
            from pylab import figure, title, pie, axes, savefig
            from pylab import sum as pylab_sum
        except ImportError:
            return self.nopylab_msg % ("pie_chart")

        # Don't bother illustrating a pie without pieces.
        if not snapshot.tracked_total:
            return ''

        classlist = []
        sizelist = []
        for k, v in list(snapshot.classes.items()):
            if v['pct'] > 3.0:
                classlist.append(k)
                sizelist.append(v['sum'])
        sizelist.insert(0, snapshot.asizeof_total - pylab_sum(sizelist))
        classlist.insert(0, 'Other')
        #sizelist = [x*0.01 for x in sizelist]

        title("Snapshot (%s) Memory Distribution" % (snapshot.desc))
        figure(figsize=(8, 8))
        axes([0.1, 0.1, 0.8, 0.8])
        pie(sizelist, labels=classlist)
        savefig(filename, dpi=50)

        return self.chart_tag % (self.relative_path(filename))
开发者ID:ppizarror,项目名称:Hero-of-Antair,代码行数:32,代码来源:classtracker_stats.py

示例4: plot

def plot(filename, column, label):
    data = py.loadtxt(filename).T
    X, Y = data[0], data[column]
    mask = (X >= xmin) * (X <= xmax)
    X, Y = X[mask], corrector(Y[mask])
    aY, bY = np.min(Y), np.max(Y)
    pad = 7 if aY < 0 and -bY/aY < 10 else 0
    py.ylabel(r'$' + label + r'$', y=y_coord, labelpad=8-pad, rotation=0)
    py.plot(X, Y, '-', lw=1)
    py.xlabel(r'$\zeta$', labelpad=-5)
    py.xlim(xmin, xmax)
    ax = py.axes()
    ax.axhline(lw=.5, c='k', ls=':')
    specify_tics(np.min(Y), np.max(Y))
    if inside:
        print "Plot inside plot"
        ax = py.axes([.25, .45, .4, .4])
        mask = X <= float(sys.argv[7])
        py.plot(X[mask], Y[mask], '-', lw=1)
        ax.tick_params(axis='both', which='major', labelsize=8)
        ax.axhline(lw=.5, c='k', ls=':')
        ax.xaxis.set_major_locator(MultipleLocator(0.5))
        ax.yaxis.set_major_locator(LinearLocator(3))
        ymin, _, ymax = ax.get_yticks()
        if (ymax + ymin) < (ymax-ymin)/5:
            y = max(ymax, -ymin)
            py.ylim(-y, y)
开发者ID:olegrog,项目名称:latex,代码行数:27,代码来源:plot.py

示例5: test_varying_inclination

    def test_varying_inclination(self):
        #""" Test that the waveform is consistent for changes in inclination
        #"""
        sigmas = []
        incs = numpy.arange(0, 21, 1.0) * lal.PI / 10.0

        for inc in incs:
            # WARNING: This does not properly handle the case of SpinTaylor*
            # where the spin orientation is not relative to the inclination
            hp, hc = get_waveform(self.p, inclination=inc)
            s = sigma(hp, low_frequency_cutoff=self.p.f_lower)        
            sigmas.append(s)
         
        f = pylab.figure()
        pylab.axes([.1, .2, 0.8, 0.70])   
        pylab.plot(incs, sigmas)
        pylab.title("Vary %s inclination, $\\tilde{h}$+" % self.p.approximant)
        pylab.xlabel("Inclination (radians)")
        pylab.ylabel("sigma (flat PSD)")
        
        info = self.version_txt
        pylab.figtext(0.05, 0.05, info)
        
        if self.save_plots:
            pname = self.plot_dir + "/%s-vary-inclination.png" % self.p.approximant
            pylab.savefig(pname)

        if self.show_plots:
            pylab.show()
        else:
            pylab.close(f)

        self.assertAlmostEqual(sigmas[-1], sigmas[0], places=7)
        self.assertAlmostEqual(max(sigmas), sigmas[0], places=7)
        self.assertTrue(sigmas[0] > sigmas[5])
开发者ID:bema-ligo,项目名称:pycbc,代码行数:35,代码来源:test_lalsim.py

示例6: __init__

    def __init__(self, cut_coords, axes=None, black_bg=False):
        """ Create 3 linked axes for plotting orthogonal cuts.

            Parameters
            ----------
            cut_coords: 3 tuple of ints
                The cut position, in world space.
            axes: matplotlib axes object, optional
                The axes that will be subdivided in 3.
            black_bg: boolean, optional
                If True, the background of the figure will be put to
                black. If you whish to save figures with a black background, 
                you will need to pass "facecolor='k', edgecolor='k'" to 
                pylab's savefig.

        """
        self._cut_coords = cut_coords
        if axes is None:
            axes = pl.axes((0., 0., 1., 1.))
            axes.axis('off')
        self.frame_axes = axes
        axes.set_zorder(1)
        bb = axes.get_position()
        self.rect = (bb.x0, bb.y0, bb.x1, bb.y1)
        self._object_bounds = dict()
        self._black_bg = black_bg

        # Create our axes:
        self.axes = dict()
        for index, name in enumerate(('x', 'y', 'z')):
            ax = pl.axes([0.3*index, 0, .3, 1])
            ax.axis('off')
            self.axes[name] = ax
            ax.set_axes_locator(self._locator)
            self._object_bounds[ax] = list()
开发者ID:bergtholdt,项目名称:nipy,代码行数:35,代码来源:ortho_slicer.py

示例7: plotwithstats

def plotwithstats(t, s):

    from matplotlib.ticker import NullFormatter

    nullfmt = NullFormatter()
    figure()
    ax2 = axes([0.125 + 0.5, 0.1, 0.2, 0.8])

    ax1 = axes([0.125, 0.1, 0.5, 0.8])

    ax1.plot(t, s)
    ax1.set_xticks(ax1.get_xticks()[:-1])

    meanv = s.mean()
    mi = s.min()
    mx = s.max()
    sd = s.std()

    ax2.bar(-0.5, mx - mi, 1, mi, lw=2, color='#f0f0f0')
    ax2.bar(-0.5, sd * 2, 1, meanv - sd, lw=2, color='#c0c0c0')
    ax2.bar(-0.5, 0.2, 1, meanv - 0.1, lw=2, color='#b0b0b0')
    ax2.axis([-1, 1, ax1.axis()[2], ax1.axis()[3]])

    ax2.yaxis.set_major_formatter(nullfmt)
    ax2.set_xticks([])

    return ax1, ax2
开发者ID:Luisa-Gomes,项目名称:Codigo_EMG,代码行数:27,代码来源:figtools.py

示例8: plot_all

 def plot_all():
     pylab.axes()
     x = [x0, x1, x2, x3, x4, x5, x6, x7, x8]
     y = [y0, y1, y2, y3, y4, y5, y6, y7, y8]
     plt.title('Retroreflective Sphere')
     plt.plot(x, y)
     plt.xlim(-0.1, 0.1)
     plt.ylim(-0.13, 0.1)
     plt.xlabel(u"[m]")
     plt.ylabel(u"[m]")
     point_num = 0
     for i, j in izip(x, y):
         if withCoords:
             plt.annotate("M%s\n" % point_num + "[%2.3e," % i + "%2.3e]" % j, xy=(i, j))
         point_num += 1
     if withArrows:
         for i in xrange(len(x) - 1):
             plt.arrow(x[i],
                       y[i],
                       x[i + 1] - x[i],
                       y[i + 1] - y[i],
                       head_width=0.005,
                       head_length=0.004,
                       fc="k",
                       ec="k",
                       width=0.00003)
开发者ID:yavalvas,项目名称:yav_com,代码行数:26,代码来源:views.py

示例9: animate

def animate(self,e,draw_bottoms=True, draw_circles=False, draw_circle_events=True):
	global i
	global past_circle_events

	filename = 'tmp-{0:03}.png'.format(i)
	#print 'animate', e, type(e), isinstance(e,voronoi.SiteEvent), isinstance(e,voronoi.CircleEvent)
	plt.clf()
	fig = plt.gcf()
	# plt.axis([0,width, 0, height])
	if self.bounding_box is not None:
		plt.axis(self.bounding_box)
	#plt.axis([-5,25, -5, 25])

	_draw_beachline(e, self.T)
	_draw_hedges(e, self.edges)
	if draw_circle_events:
		_draw_circle_events(e, self.Q, past_circle_events, draw_bottoms, draw_circles, fig)

	plot_directrix(e.y)
	plot_points(self.input)
	if e.is_site:
		plot_points([e.site], color='black')
	
	plt.grid(True)
	axes().set_aspect('equal', 'datalim')
	fig.savefig(filename, bbox_inches='tight')
	print filename, 'beachline', self.T, 'Input:', self.input
	i+=1
开发者ID:felipeblassioli,项目名称:voronoi,代码行数:28,代码来源:anim.py

示例10: plot_mesh

def plot_mesh(pts, tri, *args):
    if len(args) > 0:
        tripcolor(pts[:,0], pts[:,1], tri, args[0], edgecolor='black', cmap="Blues")
    else:
        triplot(pts[:,0], pts[:,1], tri, "k-", lw=2)
    axis('tight')
    axes().set_aspect('equal')
开发者ID:ckhroulev,项目名称:py_distmesh2d,代码行数:7,代码来源:examples.py

示例11: plot_nodes

def plot_nodes(pts, mask, *args):
    boundary = pts[mask == True]
    interior = pts[mask == False]
    plot(boundary[:,0], boundary[:,1], 'o', color="red")
    plot(interior[:,0], interior[:,1], 'o', color="white")
    axis('tight')
    axes().set_aspect('equal')
开发者ID:ckhroulev,项目名称:py_distmesh2d,代码行数:7,代码来源:examples.py

示例12: plot_matplot_lib

def plot_matplot_lib(df, show=False):

    header = list(df.columns.values)

    fig = plt.figure(figsize=(df.shape[1] * 2 + 2, 12))  
    xs, ys = generateDotPlot(np.asarray(df), space=0.15, width=5)

    x = [[i*2, h] for i, h in enumerate(header)]

    plt.scatter(x=xs, y=ys, facecolors='black',marker='o', s=15)


    plt.axes().set_aspect('equal')
    plt.axes().set_autoscale_on(False)
    plt.axes().set_ybound(0,6)
    plt.axes().set_xbound(-0.9, len(header) * 2 + 0.9)
    
    plt.xticks(zip(*x)[0], zip(*x)[1] )
    plt.yticks(range(1,6))
    
    for tick in plt.axes().get_xaxis().get_major_ticks():
        tick.set_pad(15)
        tick.label1 = tick._get_text1()
        
    for tick in plt.axes().get_yaxis().get_major_ticks():
        tick.set_pad(15)
        tick.label1 = tick._get_text1()
        
    plt.setp(plt.xticks()[1], rotation=20)

    if show:
        plt.show()

    return fig
开发者ID:groakat,项目名称:dot_plot,代码行数:34,代码来源:dotPlot.py

示例13: add_colorbar

  def add_colorbar(handle,**args):
    ax=pl.gca()
    Data,err = opt.get_plconf(plconf,'AXES')
    cbpos    = Data['cbpos'][ifig]
    cbbgpos  = Data['cbbgpos'][ifig]
    cbbgc    = Data['cbbgcolor'][ifig]
    cbbga    = Data['cbbgalpha'][ifig]
    cblab    = Data['cblabel'][ifig]

    # colorbar bg axes:
    if cbbgpos:
      rec=pl.axes((cbpos[0]-cbpos[2]*cbbgpos[0],cbpos[1]-cbbgpos[2]*cbpos[3],
                      cbpos[2]*(1+cbbgpos[0]+cbbgpos[1]),cbpos[3]*(1+cbbgpos[2]+cbbgpos[3])),
                      axisbg=cbbgc,frameon=1)

      rec.patch.set_alpha(cbbga)
      rec.set_xticks([])
      rec.set_yticks([])
      for k in rec.axes.spines.keys():
        rec.axes.spines[k].set_color(cbbgc)
        rec.axes.spines[k].set_alpha(cbbga)


    # colorbar:
    if cbpos:
      cbax=fig.add_axes(cbpos)
      if cbpos[2]>cbpos[3]: orient='horizontal'
      else: orient='vertical'
      cb=pl.colorbar(handle,cax=cbax,orientation=orient,drawedges=0,**args)
      pl.axes(ax)

      # colorbar label:
      cb.set_label(r'Wind Speed [m s$^{\rm{-1}}$]')
开发者ID:martalmeida,项目名称:OOFe,代码行数:33,代码来源:op_plot.py

示例14: set_font

def set_font(font):
    pl.xlabel('String length', fontproperties=font)
    pl.tight_layout()
    for label in pl.axes().get_xticklabels():
        label.set_fontproperties(font)
    for label in pl.axes().get_yticklabels():
        label.set_fontproperties(font)
开发者ID:avlonger,项目名称:my-experiments,代码行数:7,代码来源:graph_time.py

示例15: plot_pincrdr_probs

def plot_pincrdr_probs( f = None ):
    hist, bins = np.histogram( p_inc_rdr,
                               bins = yaml_config['rdr_histbins']['bins'],
                               range = (yaml_config['rdr_histbins']['min'],
                                        yaml_config['rdr_histbins']['max']) )
    bin_width = bins[1] - bins[0]
    # Find out which bin each read belongs to.
    # Sanity check: print [ sum( bins_ind == i ) for i in xrange(len(hist)) ] => equals hist
    bins_ind = np.sum( p_inc_rdr[:,np.newaxis] > bins[:-1], axis = 1 ) - 1
    prob_read = [ sum(rssi[bins_ind == i] != -1)*1.0 / hist[i] # positive reads / total reads for bin i
                  for i in xrange(len(hist)) # same as len(bins)-1
                  if hist[i] != 0 ] # only where we have data!  (also prevents div by 0)

    if not f:
        f = pl.figure( figsize=(10,6) )
    pl.axes([0.1,0.1,0.65,0.8])
    pos_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
                      prob_read,  # This is only defined for ones that have data!
                      width = bin_width,
                      color = 'b',
                      alpha = 0.7 )
    pl.hold( True )
    neg_bars = pl.bar([ bins[i] for i in xrange(len(hist)) if hist[i] != 0 ], # Only plot the bars for places we have data!
                      [ 1.0 - p for p in prob_read ],  # This is only defined for ones that have data!
                      width = bin_width,
                      bottom = prob_read,
                      color = 'r',
                      alpha = 0.7 )
    pl.axis([ yaml_config['rdr_axis'][0], yaml_config['rdr_axis'][1], 0.0, 1.0 ])
    pl.xlabel( '$P^{inc}_{rdr}$ (dBm)')
    pl.ylabel( 'Probability of Tag Read / No-Read')
    pl.title( 'Probability of Tag Read / No-Read vs Predicted Power at Reader ' )
    pl.legend((pos_bars[0], neg_bars[0]), ('P( read )', 'P( no read )'), loc=(1.03,0.2))

    return f
开发者ID:gt-ros-pkg,项目名称:hrl,代码行数:35,代码来源:process_friis_plots.py


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