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


Python pylab.setp函数代码示例

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


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

示例1: plot_count

def plot_count(fname, dpi=70):
    # Load data
    date, libxc, c, code, test, doc = np.loadtxt(fname, unpack=True)
    zero = pl.zeros_like(date)

    fig = pl.figure(1, figsize=(10, 5), dpi=dpi)
    ax = fig.add_subplot(111)
    polygon(date, c + libxc + code + test, c + libxc + code + test + doc, facecolor="m", label="Documentation")
    polygon(date, c + libxc + code, c + libxc + code + test, facecolor="y", label="Tests")
    polygon(date, c + libxc, c + libxc + code, facecolor="g", label="Python-code")
    polygon(date, c, c + libxc, facecolor="c", label="LibXC-code")
    polygon(date, zero, c, facecolor="r", label="C-code")
    polygon(date, zero, zero, facecolor="b", label="Fortran-code")

    months = pl.MonthLocator()
    months4 = pl.MonthLocator(interval=4)
    month_year_fmt = pl.DateFormatter("%b '%y")

    ax.xaxis.set_major_locator(months4)
    ax.xaxis.set_minor_locator(months)
    ax.xaxis.set_major_formatter(month_year_fmt)
    labels = ax.get_xticklabels()
    pl.setp(labels, rotation=30)
    pl.axis("tight")
    pl.legend(loc="upper left")
    pl.title("Number of lines")
    pl.savefig(fname.split(".")[0] + ".png", dpi=dpi)
开发者ID:eojons,项目名称:gpaw-scme,代码行数:27,代码来源:code-count.py

示例2: _add_graph

    def _add_graph(self, data):
        x = False
        if self._decimate:
            x, data = self._decimate_data(data, self._bins)

        ax = self._fig.add_axes([self._margin * 2, # left
                                    1 - self._margin - self._client_space / self._total_height * (self._counter + 1), # bottom
                                    self._client_space - self._margin, # width
                                    self._client_space / self._total_height * 0.9 # height
                                ], **self._axprops)

        if x:
            ax.plot(x, data)
        else:
            ax.plot(data)

        self._counter += 1

        if self._counter == 1:
            self._axprops['sharex'] = ax

        if self._counter < self._total_height:
            pylab.setp(ax.get_xticklabels(), visible=False)

        return ax
开发者ID:antiface,项目名称:dsp-testbed,代码行数:25,代码来源:pylab_tools.py

示例3: cmap_plot

def cmap_plot(cmdLine):

    pylab.figure(figsize=[5,10])
    a=outer(ones(10),arange(0,1,0.01))
    subplots_adjust(top=0.99,bottom=0.00,left=0.01,right=0.8)
    maps=[m for m in cm.datad if not m.endswith("_r")]
    maps.sort()
    l=len(maps)+1
    for i, m in enumerate(maps):
        print m
        subplot(l,1,i+1)
        pylab.setp(pylab.gca(),xticklabels=[],xticks=[],yticklabels=[],yticks=[])
        imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")
        pylab.text(100.85,0.5,m,fontsize=10)

# render plot

    if cmdLine: 
        pylab.show(block=True)
    else: 
        pylab.ion()
        pylab.plot([])
        pylab.ioff()
	
    status = 1
    return status
开发者ID:KeplerGO,项目名称:PyKE,代码行数:26,代码来源:kepprf.py

示例4: plot_commerror

def plot_commerror(name1,logfile1,name2,logfile2):

  file1 = open(str(logfile1),'r').readlines()
  data1 = [float(line.split()[1]) for line in file1]
  iso1 = data1[0::3]
  aniso1 = data1[1::3]
  ml1 = data1[2::3]

  file2 = open(str(logfile2),'r').readlines()
  data2 = [float(line.split()[1]) for line in file2]
  iso2 = data2[0::3]
  aniso2 = data2[1::3]
  ml2 = data2[2::3]

  # x axis
  x=[8,16,32,64,128]
  xlabels=['A','B','C','D','E']
  orderone = [1,.5,.25,.125,.0625]
  ordertwo = [i**2 for i in orderone]
  plot1 = pylab.figure(figsize = (6, 6.5))
  size = 15
  ax = pylab.subplot(111)
  ax.plot(x,iso1, linestyle='solid',color='red',lw=2)
  ax.plot(x,aniso1, linestyle='dashed',color='red',lw=2)
  ax.plot(x,ml1, linestyle='dashdot',color='red',lw=2)
  ax.plot(x,iso2, linestyle='solid',color='blue',lw=2)
  ax.plot(x,aniso2, linestyle='dashed',color='blue',lw=2)
  ax.plot(x,ml2, linestyle='dashdot',color='blue',lw=2)
  #ax.plot(x,orderone, linestyle='solid',color='black',lw=2)
  #ax.plot(x,ordertwo, linestyle='dashed',color='black')
  #pylab.legend((str(name1)+'_iso',str(name1)+'_aniso',str(name2)+'_iso',str(name2)+'_aniso','order 1'),loc="best")
  pylab.legend((str(name1)+'_iso',str(name1)+'_aniso',str(name1)+'_ml',str(name2)+'_iso',str(name2)+'_aniso',str(name2)+'_ml'),loc="best")
  leg = pylab.gca().get_legend()
  ltext = leg.get_texts()
  pylab.setp(ltext, fontsize = size, color = 'black')
  frame=leg.get_frame()
  frame.set_fill(False)
  frame.set_visible(False)

  #ax.grid("True")
  for tick in ax.xaxis.get_major_ticks():
    tick.label1.set_fontsize(size)
  for tick in ax.yaxis.get_major_ticks():
    tick.label1.set_fontsize(size)

  # set axes to logarithmic
  pylab.gca().set_xscale('log',basex=2)
  pylab.gca().set_yscale('log',basex=2)

  pylab.axis([8,128,1.e-4,2])
  ax.set_xticks(x)
  ax.set_xticklabels(xlabels)

  #pylab.axis([1,5,1.e-6,1.])
  ax.set_xlabel('Mesh resolution', ha="center",fontsize=size)
  ax.set_ylabel('commutation error',fontsize=size)
  pylab.savefig('commerrorplot.eps')
  pylab.savefig('commerrorplot.pdf')

  return
开发者ID:Nasrollah,项目名称:fluidity,代码行数:60,代码来源:plot_data.py

示例5: _draw_main_error

    def _draw_main_error(self):
        """
        plot the error with respect to the true solution on our optional
        visualization
        """
        myg = self.grids[self.nlevels - 1].grid

        v = self.grids[self.nlevels - 1].get_var("v")

        e = v - self.true_function(myg.x2d, myg.y2d)

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

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

        pylab.title(r"current fine grid error")

        formatter = matplotlib.ticker.ScalarFormatter(useMathText=True)
        cb = pylab.colorbar(format=formatter, shrink=0.5)

        cb.ax.yaxis.offsetText.set_fontsize("small")
        cl = pylab.getp(cb.ax, "ymajorticklabels")
        pylab.setp(cl, fontsize="small")
开发者ID:jzuhone,项目名称:pyro2,代码行数:29,代码来源:multigrid.py

示例6: draw_plot

    def draw_plot(self):
        if len(self.data_t) < 2:
            return
        if  self.data_t[-1] < self.data_t[-2]:
            del self.data_t[:-1]
            del self.data_y[:-1]
            del self.data_y2[:-1]
            self.axes.set_xlim(self.data_t[-1],self.data_t[-1]+20)
            return

        T1 = self.data_t[-1]
        xmin, xmax = self.axes.get_xlim()
        if T1 > xmax:
            self.axes.set_xlim(xmax,xmax+20)
            del self.data_t[:-2]
            del self.data_y[:-2]
            del self.data_y2[:-2]
            pylab.setp(self.axes.get_xticklabels(), visible=True)

        self.plot_data[0].set_data(self.data_t, self.data_y)
        self.plot_data[1].set_data(self.data_t, self.data_y2)

        if not self.drawing:
            self.drawing = True
            self.draw()
            self.drawing = False
开发者ID:klvt,项目名称:fiwt,代码行数:26,代码来源:dynamic_chart.py

示例7: init_plot

    def init_plot(self):
        self.dpi = 150
        self.fig = Figure((3.0, 3.0), dpi=self.dpi)

        self.axes = self.fig.add_subplot(111)
        self.axes.set_axis_bgcolor('black')
        self.axes.set_title('Accelerometer Values', size=12)
        
        pylab.setp(self.axes.get_xticklabels(), fontsize=8)
        pylab.setp(self.axes.get_yticklabels(), fontsize=8)

        # plot the data as a line series, and save the reference 
        # to the plotted line series
        #
        self.plot_data1 = self.axes.plot(
            self.data1, 
            linewidth=1,
            color=(1, 1, 0),
            )[0]
        self.plot_data2 = self.axes.plot(
            self.data2, 
            linewidth=1,
            color=(1, 0, 1),
            )[0]
        self.plot_data3 = self.axes.plot(
            self.data3, 
            linewidth=1,
            color=(0, 1, 1),
            )[0]
开发者ID:agupta13,项目名称:mPaaS,代码行数:29,代码来源:demo.py

示例8: plot_data

def plot_data(data_, O, P, save=False):
    assert len(data_) == 2  # Coarse, fine.
    colors = ["r", "b"]
    i = 0
    p.figure()
    p.xlabel("$\mu \, (\mathrm{GeV})$", fontsize=16)
    label = str(O + 1) + str(P + 1)
    p.ylabel("$\sigma_{0}$".format("{" + label + "}"), fontsize=16)
    legend = ()

    # Interpolate raw data.
    for data in data_:
        x_, y_, s_, x, y, s = interpolation(data, O, P)
        dada = p.plot(x, y, "o", x_, y_(x_), "-")  # ,
        # x_, y_(x_)+s_(x_), '--', x_, y_(x_)-s_(x_), '--')
        legend += (dada[1],)
        p.setp(dada, color=colors[i])
        i += 1

    # Continuum extrapolate interpolated data.
    x_, y, s = continuum_extrap(data_[0], data_[1], O, P)
    dada = p.plot(x_, y, "-")  # , x_, y+s, '--', x_, y-s, '--')
    legend += (dada[0],)
    p.setp(dada, color="green")

    p.legend(legend, ("$a=0.116 \, \mathrm{fm}$", "$a=0.088 \, \mathrm{fm}$", "$a=0$"), "best")

    # Output.
    if save:
        root = "/Users/atlytle/Dropbox/TeX_docs/soton/SUSY_BK/exceptional/figs"
        p.savefig(root + "/sigma_exceptional_{0}.pdf".format(label))
    else:
        p.show()
开发者ID:atlytle,项目名称:soton_qcd,代码行数:33,代码来源:IW_E_stepscale.py

示例9: init_plot

    def init_plot(self):
        self.dpi = 100
        self.fig = Figure((3.0, 3.0), dpi=self.dpi)
        self.axes = []
        
        for n in range(self.numplots):
            self.axes.append(self.fig.add_subplot(1,self.numplots,n))
            self.axes[n].set_title('SAS Temperature Data', size=12)
            pylab.setp(self.axes[n].get_xticklabels(), fontsize=8)
            pylab.setp(self.axes[n].get_yticklabels(), fontsize=8)

        # plot the data as a line series, and save the reference 
        # to the plotted line series
        #
        self.plot_data = []
        labels = self.datagen.labels
        for n in range(len(self.data)):
            self.plot_data.append([])
            for i in range(len(self.data[n])):
                self.plot_data[n].append(self.axes[n].plot(np.arange(10),
                                                     linewidth=1,
                                                     label=labels[n][i],
                                                     #color=(1, 1, 0),  #let it auto-select colors
                                                     )[0])
            self.axes[n].legend(loc='best',fontsize=6,ncol=6)
        self.plot_index = 0
开发者ID:HEROES-Balloon,项目名称:SAS_Telemetry_Viewer,代码行数:26,代码来源:SAS_Telemetry_Viewer.py

示例10: plot_dco_values

def plot_dco_values(ax, values, color="k"):
    interpol1 = {"temperature": values["temperature"][0:7], "values": values["values"][0:7]}
    fit1 = pylab.polyfit(interpol1["temperature"], interpol1["values"], 1)
    print "m={} b={}".format(fit1[0], fit1[1])
    fit_fn1 = pylab.poly1d(fit1)

    interpol2 = {"temperature": values["temperature"][6:14], "values": values["values"][6:14]}
    fit2 = pylab.polyfit(interpol2["temperature"], interpol2["values"], 1)
    print "m={} b={}".format(fit2[0], fit2[1])
    fit_fn2 = pylab.poly1d(fit2)

    plot = ax.plot(
        interpol1["temperature"],
        fit_fn1(interpol1["temperature"]),
        "k-",
        interpol2["temperature"],
        fit_fn2(interpol2["temperature"]),
        "k-",
        # values['temperature'], values['values'], '{}-'.format(color),
        values["temperature"],
        values["values"],
        "{}o".format(color),
        markersize=5,
    )
    pylab.setp(plot[0], linewidth=2)
    pylab.setp(plot[1], linewidth=2)

    return plot
开发者ID:salkinium,项目名称:bachelor,代码行数:28,代码来源:baudrate_parser.py

示例11: barGraph

def barGraph(data, **kw):
    """Draws a bar graph for the given data"""
    from pylab import bar
    kw.setdefault('barw', 0.5)
    kw.setdefault('log', 0)
    kw.setdefault('color', 'blue')
    xs = [i+1 for i, row in enumerate(data)]
    names, ys = zip(*data)
    names = [n.replace('_', '\n') for n in names]
    #print 'got xs %s, ys %s, names %s' % (xs, ys, names)
    bar(xs, ys, width=kw['barw'], color=kw['color'], align='center', log=kw['log'])
    ax = pylab.gca()
    def f(x, pos=None):
        n = int(x) - 1
        if n+1 != x: return ''
        if n < 0: return ''
        try:
            return names[n]
        except IndexError: return ''

    ax.xaxis.set_major_formatter(pylab.FuncFormatter(f))
    ax.xaxis.set_major_locator(pylab.MultipleLocator(1))
    ax.set_xlim(0.5, len(names)+0.5)
    for l in ax.get_xticklabels():
        pylab.setp(l, rotation=90)
    start = 0.08, 0.18
    pos = (start[0], start[1], 0.99-start[0], 0.95-start[1])
    ax.set_position(pos)
开发者ID:neeraj-kumar,项目名称:nkpylib,代码行数:28,代码来源:nkplot.py

示例12: ConfigCAngles

def ConfigCAngles():
    pylab.figure(figsize=(3.5, 3.5))
    pylab.axes((0.0, 0.0, 1.0, 1.0))
    geo = ps.LoadGeo()

    phi_i0 = geo.phi_i0
    phi_is = geo.phi_is
    phi_ie = geo.phi_ie

    phi_o0 = geo.phi_o0
    phi_os = geo.phi_os
    phi_oe = geo.phi_oe

    phi1 = np.linspace(phi_is, phi_ie, 1000)
    phi2 = np.linspace(phi_i0, phi_is, 1000)
    phi3 = np.linspace(phi_os, phi_oe, 1000)
    phi4 = np.linspace(phi_o0, phi_os, 1000)
    (xi1, yi1) = ps.coords_inv(phi1, geo, 0, "fi")
    (xi2, yi2) = ps.coords_inv(phi2, geo, 0, "fi")
    (xo1, yo1) = ps.coords_inv(phi3, geo, 0, "fo")
    (xo2, yo2) = ps.coords_inv(phi4, geo, 0, "fo")

    #### Inner and outer involutes
    pylab.plot(xi1, yi1, "k", lw=1)
    pylab.plot(xi2, yi2, "k:", lw=1)
    pylab.plot(xo1, yo1, "k", lw=1)
    pylab.plot(xo2, yo2, "k:", lw=1)

    ### Innver involute labels
    pylab.plot(xi2[0], yi2[0], "k.", markersize=5, mew=2)
    pylab.text(xi2[0], yi2[0] + 0.0025, "$\phi_{i0}$", size=8, ha="right", va="bottom")
    pylab.plot(xi1[0], yi1[0], "k.", markersize=5, mew=2)
    pylab.text(xi1[0] + 0.002, yi1[0], "$\phi_{is}$", size=8)
    pylab.plot(xi1[-1], yi1[-1], "k.", markersize=5, mew=2)
    pylab.text(xi1[-1] - 0.002, yi1[-1], "   $\phi_{ie}$", size=8, ha="right", va="center")

    ### Outer involute labels
    pylab.plot(xo2[0], yo2[0], "k.", markersize=5, mew=2)
    pylab.text(xo2[0] + 0.002, yo2[0], "$\phi_{o0}$", size=8, ha="left", va="top")
    pylab.plot(xo1[0], yo1[0], "k.", markersize=5, mew=2)
    pylab.text(xo1[0] + 0.002, yo1[0], "$\phi_{os}$", size=8)
    pylab.plot(xo1[-1], yo1[-1], "k.", markersize=5, mew=2)
    pylab.text(xo1[-1] - 0.002, yo1[-1], "   $\phi_{oe}$", size=8, ha="right", va="center")

    ### Base circle
    t = np.linspace(0, 2 * pi, 100)
    pylab.plot(geo.rb * np.cos(t), geo.rb * np.sin(t), "b-")
    pylab.plot(np.r_[0, geo.rb * np.cos(9 * pi / 8)], np.r_[0, geo.rb * np.sin(9 * pi / 8)], "k-")
    pylab.text(
        geo.rb * np.cos(9 * pi / 8) + 0.0005, geo.rb * np.sin(9 * pi / 8) + 0.001, "$r_b$", size=8, ha="right", va="top"
    )

    pylab.axis("equal")
    pylab.setp(pylab.gca(), "ylim", (min(yo1) - 0.005, max(yo1) + 0.005))
    pylab.axis("off")

    pylab.savefig("FixedScrollAngles.png", dpi=600)
    pylab.savefig("FixedScrollAngles.eps")
    pylab.savefig("FixedScrollAngles.pdf")
    pylab.close()
开发者ID:bo3mrh,项目名称:Test,代码行数:60,代码来源:paperIII.py

示例13: plot_clusters

def plot_clusters(locations, idx, centroids):
    locations = np.array(locations)
    print "the cluster labels ", idx
    plot(
        locations[idx == 0, 0],
        locations[idx == 0, 1],
        "ob",
        locations[idx == 1, 0],
        locations[idx == 1, 1],
        "or",
        locations[idx == 2, 0],
        locations[idx == 2, 1],
        "ok",
        locations[idx == 3, 0],
        locations[idx == 3, 1],
        "oc",
        locations[idx == 4, 0],
        locations[idx == 4, 1],
        "oy",
        locations[idx == 5, 0],
        locations[idx == 5, 1],
        "om",
        locations[idx == 6, 0],
        locations[idx == 6, 1],
        "og",
    )
    plot(centroids[:, 0], centroids[:, 1], "sg", markersize=8)
    setp(gca(), "ylim", reversed(getp(gca(), "ylim")))
    show()
开发者ID:qingquan,项目名称:experiment,代码行数:29,代码来源:pruning.py

示例14: init_plot

    def init_plot(self):
        self.fig = Figure((4.0, 2.0), dpi=100)

        self.axes = self.fig.add_subplot(111)
        self.axes.set_axis_bgcolor('black')
        #self.axes.set_title('Rotation', size=12)
        
        pylab.setp(self.axes.get_xticklabels(), fontsize=8)
        pylab.setp(self.axes.get_yticklabels(), fontsize=8)

        # plot the data as a line series, and save the reference 
        # to the plotted line series
        #
        self.plotLinex = self.axes.plot(
            self.pldatLineX, 
            linewidth=1,
            color=(1, 0, 0),
            )[0]
        self.plotLiney = self.axes.plot(
            self.pldatLineY, 
            linewidth=1,
            color=(0, 1, 0),
            )[0]
        self.plotLinez = self.axes.plot(
            self.pldatLineZ, 
            linewidth=1,
            color=(0, 0, 1),
            )[0]
        
        self.xmin = 0
        self.xmax = 0
        self.ymin = -10
        self.ymax = 10
开发者ID:mdicke2s,项目名称:yudrone,代码行数:33,代码来源:plot.py

示例15: __init__

    def __init__(self, ticker):
        gtk.VBox.__init__(self)

        startdate = datetime.date(2001, 1, 1)
        today = enddate = datetime.date.today()

        date1 = datetime.date(2011, 1, 1)
        date2 = datetime.date.today()

        mondays = WeekdayLocator(MONDAY)  # major ticks on the mondays
        alldays = DayLocator()  # minor ticks on the days
        weekFormatter = DateFormatter("%b %d")  # Eg, Jan 12
        dayFormatter = DateFormatter("%d")  # Eg, 12

        quotes = quotes_historical_yahoo(ticker, date1, date2)
        if len(quotes) == 0:
            raise SystemExit

        fig = Figure(facecolor="white", figsize=(5, 4), dpi=100)
        fig.subplots_adjust(bottom=0.2)
        ax = fig.add_subplot(111)
        ax.xaxis.set_major_locator(mondays)
        ax.xaxis.set_minor_locator(alldays)
        ax.xaxis.set_major_formatter(weekFormatter)
        candlestick(ax, quotes, width=0.6)

        ax.xaxis_date()
        ax.autoscale_view()
        pylab.setp(pylab.gca().get_xticklabels(), rotation=45, horizontalalignment="right")

        canvas = FigureCanvas(fig)  # a gtk.DrawingArea
        self.pack_start(canvas)
        toolbar = NavigationToolbar(canvas, win)
        self.pack_start(toolbar, False, False)
开发者ID:nicolasmarti,项目名称:misc-dev-2,代码行数:34,代码来源:yhstckcancas.py


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