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


Python pylab.cla函数代码示例

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


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

示例1: plot_timeseries

    def plot_timeseries(self, ax=None, vmin=None, vmax=None,
            colorbar=False, label=True):

        if vmin is None:
            vmin = self.vmin

        if vmax is None:
            vmax = self.vmax

        if ax is None:
            ax = plt.gca()
        plt.sca(ax)
        plt.cla()
        plt.imshow(self.tser_arr[::-1,:], vmin=vmin, vmax=vmax,
            interpolation='Nearest', extent=self.extent, origin='upper',aspect='auto')
        plt.xlim(self.extent[0], self.extent[1])
        plt.ylim(self.extent[2], self.extent[3])
        # plt.vlines(self.ionogram_list[0].time, self.extent[2], self.extent[3], 'r')
        if label:
           celsius.ylabel('f / MHz')

        if colorbar:
            old_ax = plt.gca()
            plt.colorbar(
                    cax = celsius.make_colorbar_cax(), ticks=self.cbar_ticks
                ).set_label(r"$Log_{10} V^2 m^{-2} Hz^{-1}$")
            plt.sca(old_ax)
开发者ID:irbdavid,项目名称:mex,代码行数:27,代码来源:aisreview.py

示例2: draw_heatmap

def draw_heatmap(allstats, outfigure, order=None):
  conds, seqname, mean = allstats.Get(_.cond, _.seqname, _.mean)();
  df = pd.DataFrame({ 'conds': conds, 'seqname': seqname, 'mean':mean})
  df = df.pivot('conds', 'seqname', 'mean')
  plt.cla(); plt.clf();
  ax = sns.heatmap(df, center=1.0)
  plt.savefig('%s/condlibratios.svg' % output_dir)
开发者ID:thiesgehrmann,项目名称:Homokaryon-Expression,代码行数:7,代码来源:analysis.py

示例3: draw_lineplot

def draw_lineplot(x, y, title="title", xlab="x", ylab="y", odir="", xlim=None, ylim=None, outfmt='eps'):

  if len(x) == 0 or len(y) == 0:
    return;
  #fi

  plt.cla();
  plt.plot(x, y, marker='x');
  plt.xlabel(xlab);
  plt.ylabel(ylab);
  plt.title(title);

  if xlim == None:
    xmin = min(x);
    xmax = max(x);
    xlim = [xmin, xmax];
  #fi

  if ylim == None:
    ymin = min(y);
    ymax = max(y);
    ylim = [ymin, ymax];
  #fi

  plt.xlim(xlim);
  plt.ylim(ylim);

  plt.savefig('%s%s.%s' % (odir + ('/' if odir else ""), '_'.join(title.split(None)), outfmt), format=outfmt);

  return '%s.%s' % ('_'.join(title.split(None)), outfmt), title;
开发者ID:WenchaoLin,项目名称:delftrnaseq,代码行数:30,代码来源:splicing_statistics.py

示例4: draw_light_plot

def draw_light_plot():
    if "userid" not in session:
        return redirect(url_for("index"))
    uid = session["userid"]
    if uid not in users:
        return redirect(url_for("index"))
    users[uid].record_as_active()

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window

    # create light summary plot
    fig = plt.figure()
    ax = fig.add_subplot(111)
    users[uid].summary.plot_light(ax)
    fig.patch.set_facecolor("#fff9f0")
    fig.set_size_inches(8, 8)

    # post-process for html
    canvas = FigureCanvas(fig)
    png_output = StringIO.StringIO()
    canvas.print_png(png_output)
    response = make_response(png_output.getvalue())
    response.headers["Content-Type"] = "image/png"

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window
    return response
开发者ID:peterkomar-hu,项目名称:SunnyMinutes,代码行数:30,代码来源:views.py

示例5: showSkyline

def showSkyline(l):
    pylab.cla()
    for tuple in l:
        st = tuple[0]
        end = tuple[1]
        height = tuple[2]
        pylab.bar(st,height,(end-st))
    pylab.show()
    print "Done"
开发者ID:palsumitpal,项目名称:sumitpython,代码行数:9,代码来源:SkylineNew.py

示例6: draw_building_zoom

def draw_building_zoom():
    if "userid" not in session:
        return redirect(url_for("index"))
    uid = session["userid"]
    if uid not in users:
        return redirect(url_for("index"))
    users[uid].record_as_active()

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window

    fig = plt.figure()
    ax = fig.add_axes([0, 0, 1, 1])
    radius = ZOOM_SIZE / 2 * 1.5
    for key in users[uid].buildings:
        if users[uid].obs.distance_from_building(users[uid].buildings[key]) < radius:
            if key not in users[uid].building_keys_at_address:
                users[uid].buildings[key].plot_footprint(ax, color="k")
            else:
                users[uid].buildings[key].plot_footprint(ax, color=COLOR_LIGHTBROWN)
    users[uid].obs.plot_observers_location(ax, color="r")

    L = ZOOM_SIZE / 2  # half size of the plotted area in meters
    ax.set_xlim([users[uid].obs.x - L, users[uid].obs.x + L])
    ax.set_ylim([users[uid].obs.y - L, users[uid].obs.y + L])
    ax.xaxis.set_visible(False)
    ax.yaxis.set_visible(False)
    ax.axis("off")
    ax.set_aspect("equal")

    number_of_floors = users[uid].get_number_of_floors()
    ax.text(
        users[uid].obs.x,
        users[uid].obs.y + L / 5,
        "floors: " + str(number_of_floors),
        verticalalignment=u"center",
        horizontalalignment=u"center",
        size="large",
        color="r",
    )

    fig.patch.set_facecolor("#d4c3a8")
    fig.set_size_inches(5, 5)

    # post-process for html
    canvas = FigureCanvas(fig)
    png_output = StringIO.StringIO()
    canvas.print_png(png_output)
    response = make_response(png_output.getvalue())
    response.headers["Content-Type"] = "image/png"

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window
    return response
开发者ID:peterkomar-hu,项目名称:SunnyMinutes,代码行数:56,代码来源:views.py

示例7: __del__

    def __del__(self):
        """
        Figures created through the pyplot interface
        (`matplotlib.pyplot.figure`) are retained until explicitly
        closed and may co nsume too much memory.
        """

        plt.cla()
        plt.clf()
        plt.close()
开发者ID:SHINOTECH,项目名称:dicomecg_convert,代码行数:10,代码来源:ecg.py

示例8: plots

def plots(u,xvals,t):
    plt.cla()
    plt.plot(xvals,u)
    plt.ylim(-0.1, 1.1)
    plt.xlim( 0.0, 1.0)
    plt.xlabel(r'$x$',fontsize = 15)
    plt.ylabel(r'$u$',fontsize = 15)
    plt.title(r'Time: $t$ = ' + str(t).ljust(4, str(0)))
    plt.grid("on")
    fig.canvas.draw()
    return
开发者ID:coryahrens,项目名称:radiative-rg,代码行数:11,代码来源:IIPDG-diffusive-wave.py

示例9: draw_graph

def draw_graph(plot_data, rankingSystem, numberOfUv, hue):
    plot_data['world_rank'] = plot_data['world_rank'].astype(int)
    ax = sns.pointplot(x='year', y='world_rank', hue=hue, data=plot_data);
    pylab.title("Top " + str(numberOfUv) + " university by " + rankingSystem, fontsize=26)
    pylab.xticks(fontsize=20)
    pylab.yticks(fontsize=20)
    pylab.ylabel("World Rank", fontsize=26)
    pylab.xlabel("Year", fontsize=26)
    pylab.savefig('resources/images/topuv.png')
    pylab.cla()
    pylab.clf()
    pylab.close()
开发者ID:manozbiswas,项目名称:Djangoapp,代码行数:12,代码来源:views.py

示例10: mkHistogram

def mkHistogram(data,sndx):
	print type(data[2])
	histDat = pl.hist(data,360,normed=1,color='black',histtype='step',label='Angle %s' %(sndx))
	pl.legend()
	pl.xlim(-180,180)
	pl.xlabel('Angle [deg.]',fontsize=16)
	pl.ylabel('Probability density',fontsize=16)
	pl.xticks(fontsize=12)
	pl.yticks(fontsize=12)
	pl.savefig('%s_hist.pdf' %(sndx))
	pl.cla()
	return histDat # sp.histogram(data,360)
开发者ID:dzanek,项目名称:dppc,代码行数:12,代码来源:getAngle.py

示例11: plot_frequency_altitude

    def plot_frequency_altitude(self, f=2.0, ax=None, median_filter=False,
        vmin=None, vmax=None, altitude_range=(-99.9, 399.9), colorbar=False, return_image=False, annotate=True):

        if vmin is None:
            vmin = self.vmin

        if vmax is None:
            vmax = self.vmax

        if ax is None:
            ax = plt.gca()

        plt.sca(ax)
        plt.cla()
        freq_extent = (self.extent[0], self.extent[1],
            altitude_range[1], altitude_range[0])

        i = self.ionogram_list[0]
        inx = 1.0E6* (i.frequencies.shape[0] * f) / (i.frequencies[-1] - i.frequencies[0])
        img = self.tser_arr_all[:,int(inx),:]

        new_altitudes = np.arange(altitude_range[0], altitude_range[1], 14.)
        new_img = np.zeros((new_altitudes.shape[0], img.shape[1])) + np.nan

        for i in self.ionogram_list:
            e = int( round((i.time - self.extent[0]) / ais_code.ais_spacing_seconds ))

            pos = mex.iau_r_lat_lon_position(float(i.time))
            altitudes = pos[0] - ais_code.speed_of_light_kms * ais_code.ais_delays * 0.5 - mex.mars_mean_radius_km
            s = np.argsort(altitudes)
            new_img[:, e] = np.interp(new_altitudes, altitudes[s], img[s,e], left=np.nan, right=np.nan)

        plt.imshow(new_img, vmin=vmin, vmax=vmax,
            interpolation='Nearest', extent=freq_extent, origin='upper', aspect='auto')

        plt.xlim(freq_extent[0], freq_extent[1])
        plt.ylim(*altitude_range)

        ax.set_xlim(self.extent[0], self.extent[1])
        ax.xaxis.set_major_locator(celsius.SpiceetLocator())

        celsius.ylabel(r'Alt./km')
        if annotate:
            plt.annotate('f = %.1f MHz' % f, (0.02, 0.9),
                    xycoords='axes fraction', color='cyan', verticalalignment='top', fontsize='small')

        if colorbar:
            old_ax = plt.gca()
            plt.colorbar(cax = celsius.make_colorbar_cax(), ticks=self.cbar_ticks).set_label(r"$Log_{10} V^2 m^{-2} Hz^{-1}$")
            plt.sca(old_ax)

        if return_image:
            return new_img, freq_extent, new_altitudes
开发者ID:irbdavid,项目名称:mex,代码行数:53,代码来源:aisreview.py

示例12: draw_gene_isoforms

def draw_gene_isoforms(D, gene_id, outfile, outfmt):

  import matplotlib.patches as mpatches;
  from matplotlib.collections import PatchCollection;

  ISO = D[_.orig_gene == gene_id].GroupBy(_.alt_gene).Without(_.orig_gene, _.orig_exon_start, _.orig_exon_end).Sort(_.alt_gene);

  plt.cla();

  y_loc   = 0;
  y_step  = 30;
  n_iso   = ISO.alt_gene.Shape()();
  origins = np.array([ [0, y] for y in xrange((y_step * (n_iso+1)),n_iso,-y_step) ]);
  patch_h = 10;

  xlim = [ ISO.exon_start.Min().Min()(), ISO.exon_end.Max().Max()()];
  ylim = [ y_step, (y_step * (n_iso+1)) + 2*patch_h];

  patches = [];
  
  for (origin, alt_id, starts, ends, exons, retention, alt5, alt3, skipped, new, ident) in zip(origins, *ISO()):

    plt.gca().text( min(starts), origin[1] + patch_h, alt_id, fontsize=10);
    for (exon_start, exon_end, exon_coverage, exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new, exon_ident) in zip(starts, ends, exons, retention, alt5, alt3, skipped, new, ident):
      if not(exon_skipped):
        patch = mpatches.FancyBboxPatch(origin + [ exon_start, 0], exon_end - exon_start, patch_h, boxstyle=mpatches.BoxStyle("Round", pad=0), color=draw_gene_isoforms_color(exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new, exon_ident));
        text_x, text_y = origin + [ exon_start, +patch_h/2];
        annots = zip(['Retention', "Alt 5'", "Alt 3'", "Skipped", 'New'], [exon_retention, exon_alt5, exon_alt3, exon_skipped, exon_new]);
        text  = '%s: %s' %( ','.join([str(exid) for exid in exon_coverage]), '\n'.join([ s for (s,b) in annots if b]));
        plt.gca().text(text_x, text_y, text, fontsize=10, rotation=-45);
        plt.gca().add_patch(patch);

        if all(ident):
          plt.gca().plot([exon_start, exon_start], [origin[1], 0], '--k', alpha=0.3);
          plt.gca().plot([exon_end, exon_end], [origin[1], 0], '--k', alpha=0.3);
        #fi
      #fi
    #efor
  #efor

  plt.xlim(xlim);
  plt.ylim(ylim);
  plt.title('Isoforms for gene %s' % gene_id);
  plt.xlabel('Location on chromosome');
  plt.gca().get_yaxis().set_visible(False);
  plt.gca().spines['top'].set_color('none');
  plt.gca().spines['left'].set_color('none');
  plt.gca().spines['right'].set_color('none');
  plt.tick_params(axis='x', which='both', top='off', bottom='on');
  plt.savefig(outfile, format=outfmt);

  return ISO;
开发者ID:WenchaoLin,项目名称:delftrnaseq,代码行数:52,代码来源:splicing_statistics.py

示例13: drawBarAXBarChart

def drawBarAXBarChart(bar1_series, bar2_series, title, xlabel, y_bar1_label, y_bar2_label, xticklabels, bar1_label, bar2_label):
    n_groups = xticklabels.size
    fig, ax = plt.subplots(dpi=100, figsize=(16,8))

    index = np.arange(n_groups)
    bar_width = 0.25

    opacity = 0.4
    error_config = {'ecolor': '0.3'}
    def autolabel(ax, rects):
        # attach some text labels
        for rect in rects:
            height = rect.get_height()
            ax.text(rect.get_x() + rect.get_width()/2., 1.005*height,
                    '%d' % int(height),
                    ha='center', va='bottom', fontproperties=myFont, size=tipSize-1)
    rects = plt.bar(index, bar1_series, bar_width,
                    alpha=opacity,
                    color='b',
                    error_kw=error_config,
                    label=bar1_label)
    autolabel(ax,rects)              
    plt.xlabel(xlabel, fontproperties=myFont, size=titleSize)
    plt.ylabel(y_bar1_label, fontproperties=myFont, size=titleSize, color='b')
    for label in ax.get_yticklabels():
        label.set_color('b')
    plt.title(title, fontproperties=myFont, size=titleSize)
    plt.xticks(index + (1/2.)*bar_width, xticklabels, fontproperties=myFont, size=tipSize)
    plt.legend(prop=font_manager.FontProperties(fname='/Library/Fonts/Songti.ttc', size=tipSize))
    
    print 'drawNBarChart',title,'1 over'
    ax1 = ax.twinx()
    rects1 = plt.bar(index+1*bar_width, bar2_series, bar_width,
                    alpha=opacity,
                    color='r',
                    error_kw=error_config,
                    label=bar2_label, axes=ax1)
    autolabel(ax1,rects1)              
    for label in ax1.get_yticklabels():
        label.set_color('r')
    plt.ylabel(y_bar2_label, fontproperties=myFont, size=titleSize, color='r')
    plt.xticks(index + (2/2.)*bar_width, xticklabels, fontproperties=myFont, size=tipSize)
    plt.legend((rects, rects1), (bar1_label, bar2_label),prop=font_manager.FontProperties(fname='/Library/Fonts/Songti.ttc', size=tipSize))
    
    plt.tight_layout()
    
    plt.savefig(sv_file_dir+'/'+title+'.png', format='png')
    plt.cla()
    plt.clf()
    plt.close()
    print 'drawNBarChart',title,'2 over'
开发者ID:codedjw,项目名称:DataAnalysis,代码行数:51,代码来源:qyw_6th_user_analysis.py

示例14: drawPieChart

def drawPieChart(data, labels, title):
    fig = plt.figure(dpi=100, figsize=(8,8))
    # first axes
    ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])
    patches, texts, autotexts = ax1.pie(data, labels=labels, autopct='%1.1f%%', colors=['yellowgreen', 'gold', 'lightskyblue', 'lightcoral'])
    plt.setp(autotexts, fontproperties=myFont, size=tipSize)
    plt.setp(texts, fontproperties=myFont, size=tipSize)
    ax1.set_title(title,fontproperties=myFont, size=titleSize)
    ax1.set_aspect(1)
    #plt.show()
    plt.savefig(sv_file_dir+'/'+title+'.png', format='png')
    plt.cla()
    plt.clf()
    plt.close()
    print 'drawPieChart',title,'over'
开发者ID:codedjw,项目名称:DataAnalysis,代码行数:15,代码来源:qyw_6th_user_analysis.py

示例15: draw_inverted_polar_plot

def draw_inverted_polar_plot():
    if "userid" not in session:
        return redirect(url_for("index"))
    uid = session["userid"]
    if uid not in users:
        return redirect(url_for("index"))
    users[uid].record_as_active()

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window

    fig = plt.figure()
    ax = fig.add_axes([0, 0, 1, 1])
    users[uid].sil.draw_inverted_polar(ax, color="k")
    this_year = dt.datetime.today().year
    dates_to_plot = [dt.datetime(this_year, 6, 21), dt.datetime.today(), dt.datetime(this_year, 12, 22)]
    morning_colors = ["#ffc469", "#fd8181", "#ffc469"]
    afternoon_colors = ["#f98536", "r", "#f98536"]
    labels = ["Jun 21", "today", "Dec 22"]
    text_colors = ["#f98536", "r", "#f98536"]
    for i in range(0, len(dates_to_plot)):
        d = dates_to_plot[i]
        cm = morning_colors[i]
        ca = afternoon_colors[i]
        ct = text_colors[i]
        l = labels[i]
        sun = SunPath(stepsize=SUN_STEPSIZE, lat=users[uid].obs.lat, lon=users[uid].obs.lon, date=d)
        sun.calculate_path()
        sun.calculate_visibility(users[uid].sil)
        sun.draw_inverted_polar(ax, morning_color=cm, afternoon_color=ca, text_color=ct, label=l)

    ax.axis("off")
    ax.set_aspect("equal")
    fig.patch.set_facecolor("#fff9f0")
    fig.set_size_inches(8, 8)

    # post-process for html
    canvas = FigureCanvas(fig)
    png_output = StringIO.StringIO()
    canvas.print_png(png_output)
    response = make_response(png_output.getvalue())
    response.headers["Content-Type"] = "image/png"

    plt.cla()  # Clear axis
    plt.clf()  # Clear figure
    plt.close()  # Close a figure window
    return response
开发者ID:peterkomar-hu,项目名称:SunnyMinutes,代码行数:48,代码来源:views.py


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