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

Python pyplot.cla函数代码示例

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

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



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

示例1: graph_ROC

def graph_ROC(max_ACC, TP, FP, name="STD"):
    aTP = np.vstack(TP)
    n = len(TP)
    mean_TP = np.mean(aTP, axis=0)
    stderr_TP = np.std(aTP, axis=0) / (n ** 0.5)
    var_TP = np.var(aTP, axis=0)
    max_TP = mean_TP + 3 * stderr_TP
    min_TP = mean_TP - 3 * stderr_TP

    # sTP = sum(TP) / len(TP)
    sFP = FP[0]
    print len(sFP), len(mean_TP), len(TP[0])
    smax_ACC = np.mean(max_ACC)

    plt.cla()
    plt.clf()
    plt.close()

    plt.plot(sFP, mean_TP)
    plt.fill_between(sFP, min_TP, max_TP, color='black', alpha=0.2)
    plt.xlim((0,0.1))
    plt.ylim((0,1))
    plt.title('ROC Curve (accuracy=%.3f)' % smax_ACC)
    plt.xlabel('False Positive Rate')
    plt.ylabel('True Positive Rate')
    plt.savefig(r"../scratch/"+name+"_ROC_curve.pdf", bbox_inches='tight')

    # Write the data to the file
    f = file(r"../scratch/"+name+"_ROC_curve.csv", "w")
    f.write("FalsePositive,TruePositive,std_err, var, n\n")
    for fp, tp, err, var in zip(sFP, mean_TP, stderr_TP, var_TP):
        f.write("%s, %s, %s, %s, %s\n" % (fp, tp, err, var, n))
    f.close()
开发者ID:gdanezis,项目名称:trees,代码行数:33,代码来源:malware.py


示例2: plot2

    def plot2(self,oligodata,name):        
        for level in oligodata:
            valcheck=['z(a)','z(c)','z(g)','z(t)','z(t+a)/z(c+g)']
            x=[]
            y=[]
            maxval=0
            for val in oligodata[level]:
                if (val not in valcheck) and (oligodata[level][val]>maxval):
                    maxval-=maxval
                    maxval+=oligodata[level][val]
                if (val not in valcheck):
                    cval=self.get_C(val[0:int(name[3])-1])
                    cval=cval+'a+'+cval+'c+'+cval+'g+'+cval+'t'
                    if (cval not in valcheck):
                        valcheck.append(val)
                        valcheck.append(cval)
                        x.append(oligodata[level][val])
                        y.append(oligodata[level][cval])
            maxval=maxval+0.05*maxval
##            print 'maxval=',maxval
            plt.plot(x,y,'k+')
            plt.plot([-1,maxval],[-1,maxval],'k')
##            plt.xlabel('x')
##            plt.ylabel('y')
            plt.text(maxval/2,maxval-2*float(maxval)/100,r'$S_{'+ level+'}^{'+self.sotype+'}$',va='top',ha='center',fontsize=20)
##            plt.legend()
            resname=self.inpufile.path+name+'_'+level.rpartition('/')[0]+'-'+level.rpartition('/')[2]+'.pdf'
            plt.savefig(resname)
            plt.cla()
        plt.close()        
开发者ID:Vitaly-Svirin,项目名称:fgnpy,代码行数:30,代码来源:FGN_statistics.py


示例3: run_test

def run_test(name):
    basepath = os.path.join('results', name)
    if not os.path.exists(basepath):
        os.makedirs(basepath)

    ctrl = LBSimulationController(TestLDCSim)
    ctrl.run(ignore_cmdline=True)
    horiz = np.loadtxt('ldc_golden/re400_horiz', skiprows=1)
    vert = np.loadtxt('ldc_golden/re400_vert', skiprows=1)

    plt.plot(2 * (horiz[:,0] - 0.5), -2 * (horiz[:,1] - 0.5), '.', label='Sheu, Tsai paper')
    plt.plot(2 * (vert[:,0] - 0.5), -2 * (vert[:,1] - 0.5), '.', label='Sheu, Tsai paper')
    save_output(basepath, MAX_ITERS)
    plt.legend(loc='lower right')
    plt.gca().yaxis.grid(True)
    plt.gca().xaxis.grid(True)
    plt.gca().xaxis.grid(True, which='minor')
    plt.gca().yaxis.grid(True, which='minor')

    plt.title('Lid Driven Cavity, Re = 400')
    print os.path.join(basepath, 're400.pdf' )
    plt.savefig(os.path.join(basepath, 're400.pdf' ), format='pdf')

    plt.clf()
    plt.cla()
    plt.show()
    shutil.rmtree(tmpdir)
开发者ID:PokerN,项目名称:sailfish,代码行数:27,代码来源:ldc_3d.py


示例4: generate_plots

def generate_plots(session, result_dir, output_dir):
    ratios = read_ratios(result_dir)

    iteration = session.query(func.max(cm2db.RowMember.iteration))
    clusters = [r[0] for r in session.query(cm2db.RowMember.cluster).distinct().filter(
        cm2db.RowMember.iteration == iteration)]

    figure = plt.figure(figsize=(6,3))
    for cluster in clusters:
        plt.clf()
        plt.cla()
        genes = [r.row_name.name for r in session.query(cm2db.RowMember).filter(
            and_(cm2db.RowMember.cluster == cluster, cm2db.RowMember.iteration == iteration))]
        cluster_conds = [c.column_name.name for c in session.query(cm2db.ColumnMember).filter(
            and_(cm2db.ColumnMember.cluster == cluster, cm2db.ColumnMember.iteration == iteration))]
        all_conds = [c[0] for c in session.query(cm2db.ColumnName.name).distinct()]
        non_cluster_conds = [cond for cond in all_conds if not cond in set(cluster_conds)]

        cluster_data = ratios.loc[genes, cluster_conds]
        non_cluster_data = ratios.loc[genes, non_cluster_conds]
        min_value = ratios.min()
        max_value = ratios.max()
        for gene in genes:
            values = [normalize_js(val) for val in cluster_data.loc[gene,:].values]
            values += [normalize_js(val) for val in non_cluster_data.loc[gene,:].values]
            plt.plot(values)

        # plot the "in"/"out" separator line
        cut_line = len(cluster_conds)
        plt.plot([cut_line, cut_line], [min_value, max_value], color='red',
                 linestyle='--', linewidth=1)
        plt.savefig(os.path.join(output_dir, "exp-%d" % cluster))
    plt.close(figure)
开发者ID:baliga-lab,项目名称:cmonkey2,代码行数:33,代码来源:plot_expressions.py


示例5: plot_scores

def plot_scores(fn,expa,x,y,xl,yl,title=''):
    Persons(expa).plot(plt,x,y)
    plt.title('PLS, '+str(len(y))+' samples'+title)
    plt.xlabel(xl)
    plt.ylabel(yl)
    plt.savefig(out_pre+"scores"+fn+".png")
    plt.cla()
开发者ID:vrepina,项目名称:linre,代码行数:7,代码来源:linre21.py


示例6: vis_detections

def vis_detections(im, class_name, dets, thresh=0.3):
    """Visual debugging of detections."""
    import matplotlib.pyplot as plt
    im_show = im
    if sdha_cfg.channels == 3:
        im = im[:, :, (2, 1, 0)]
        im_show = im
    elif sdha_cfg.channels == 4:
        b,g,r,mhi = cv2.split(im)
        im_show = cv2.merge([r,g,b])
    else:
        pass
    for i in xrange(np.minimum(10, dets.shape[0])):
        bbox = dets[i, :4]
        score = dets[i, -1]
        if score > thresh:
            plt.cla()
            plt.imshow(im_show)
            plt.gca().add_patch(
                plt.Rectangle((bbox[0], bbox[1]),
                              bbox[2] - bbox[0],
                              bbox[3] - bbox[1], fill=False,
                              edgecolor='g', linewidth=3)
                )
            plt.title('{}  {:.3f}'.format(class_name, score))
            plt.show()
开发者ID:shls,项目名称:py-faster-rcnn,代码行数:26,代码来源:test.py


示例7: _update

    def _update(num, data):
        nonlocal cmap1, bins, ax

        # clear axes, load data to refresh
        plt.cla()
        data = np.loadtxt(core_dict['DataFolder'] + "/data0.txt", float)

        # plots
        plt.axvline(x = np.average(data),
            color = cmap1(0.5),
            ls="--" ,
            linewidth=1.7)
        plt.hist(data, bins,
            alpha=0.6,
            normed=1,
            facecolor=cmap1(0.8),
            label="X ~ Beta(2,5)")

        # labels
        legend = plt.legend(loc='upper right', framealpha = 1.0)
        legend.get_frame().set_linewidth(1)
        plt.title(core_dict['PlotTitle'], style='italic')

        plt.xlabel('Regret')
        plt.ylabel('Frequency')
        ax.set_ylim([0,0.2])
开发者ID:alexrutar,项目名称:banditvisualization,代码行数:26,代码来源:animation.py


示例8: update

    def update():
        pyplot.cla()
        pyplot.axis([0, 255, -128, 128])
        pyplot.ylabel("Error (higher means too bright)")
        pyplot.xlabel("Ideal colour")
        pyplot.grid()

        delta = [0, 0, 0]
        for n, ideal, measured in pop_with_progress(analyse_colours_video(), 50):
            pyplot.draw()
            for c in [0, 1, 2]:
                ideals[c].append(ideal[c])
                delta[c] = measured[c] - ideal[c]
                deltas[c].append(delta[c])
            pyplot.plot([ideal[0]], [delta[0]], "rx", [ideal[1]], [delta[1]], "gx", [ideal[2]], [delta[2]], "bx")

        fits = [fit_fn(ideals[n], deltas[n]) for n in [0, 1, 2]]
        pyplot.plot(
            range(0, 256),
            [fits[0](x) for x in range(0, 256)],
            "r-",
            range(0, 256),
            [fits[1](x) for x in range(0, 256)],
            "g-",
            range(0, 256),
            [fits[2](x) for x in range(0, 256)],
            "b-",
        )
        pyplot.draw()
开发者ID:Navaneethsen,项目名称:stb-tester,代码行数:29,代码来源:stbt-camera-calibrate.py


示例9: update

def update(frame_number):
    plt.cla()
    if map_msg is not None:
        for lane in map_msg.hdmap.lane:
            draw_lane_boundary(lane, ax, 'b', map_msg.lane_marker)
            draw_lane_central(lane, ax, 'r')

        for key in map_msg.navigation_path:
            x = []
            y = []
            for point in map_msg.navigation_path[key].path.path_point:
                x.append(point.y)
                y.append(point.x)
            ax.plot(x, y, ls='-', c='g', alpha=0.3)

    if planning_msg is not None:
        x = []
        y = []
        for tp in planning_msg.trajectory_point:
            x.append(tp.path_point.y)
            y.append(tp.path_point.x)
        ax.plot(x, y, ls=':', c='r', linewidth=5.0)

    ax.axvline(x=0.0, alpha=0.3)
    ax.axhline(y=0.0, alpha=0.3)
    ax.set_xlim([10, -10])
    ax.set_ylim([-10, 200])
    y = 10
    while y < 200:
        ax.plot([10, -10], [y, y], ls='-', c='g', alpha=0.3)
        y = y + 10
    plt.yticks(np.arange(10, 200, 10))
    adc = plt.Circle((0, 0), 0.3, color='r')
    plt.gcf().gca().add_artist(adc)
    ax.relim()
开发者ID:GeoffGao,项目名称:apollo,代码行数:35,代码来源:relative_map_viewer.py


示例10: plot_session_PSTH

    def plot_session_PSTH(self, session, tetrode, experiment=-1, site=-1, cluster = None, sortArray='currentFreq', timeRange = [-0.5, 1], replace=0, lw=3, colorEachCond=None):
        sessionObj = self.get_session_obj(session, experiment, site)
        sessionDir = sessionObj.ephys_dir()

        ephysData, bdata, info = self.load_session_data(session, experiment, site, tetrode, cluster)
        eventOnsetTimes = ephysData['events']['stimOn']
        spikeTimestamps = ephysData['spikeTimes']
        if bdata is not None:
            sortArray = bdata[sortArray]
            if colorEachCond is None:
                colorEachCond = self.get_colours(len(np.unique(sortArray)))
        else:
            sortArray = []
        plotTitle = info['sessionDir']

        ephysData = ephyscore.load_ephys(sessionObj.subject, sessionObj.paradigm, sessionDir, tetrode, cluster)
        eventOnsetTimes = ephysData['events']['stimOn']
        spikeTimestamps = ephysData['spikeTimes']

        if replace==1:
            plt.cla()
        elif replace==2:
            plt.sca(ax)
        else:
            plt.figure()
        plot_psth(spikeTimestamps, eventOnsetTimes, sortArray = sortArray, timeRange=timeRange, lw=lw, colorEachCond=colorEachCond, plotLegend=0)
开发者ID:sjara,项目名称:jaratoolbox,代码行数:26,代码来源:ephysinterface.py


示例11: plot_session_freq_tuning

    def plot_session_freq_tuning(self, session, tetrode, experiment = -1, site = -1, cluster = None, sortArray='currentFreq', replace=0, timeRange=[0,0.1]):
        if replace:
            plt.cla()
        else:
            plt.figure()
        sessionObj = self.get_session_obj(session, experiment, site)
        sessionDir = sessionObj.ephys_dir()

        ephysData, bdata, info = self.load_session_data(session, experiment, site, tetrode, cluster)
        freqEachTrial = bdata[sortArray]

        # eventData = self.loader.get_session_events(sessionDir)
        # eventOnsetTimes = self.loader.get_event_onset_times(eventData)
        # spikeData = self.loader.get_session_spikes(sessionDir, tetrode, cluster)
        # spikeTimestamps = spikeData.timestamps
        eventOnsetTimes = ephysData['events']['stimOn']
        spikeTimestamps = ephysData['spikeTimes']


        plotTitle = sessionDir
        freqLabels = ["%.1f"%freq for freq in np.unique(freqEachTrial)/1000]
        self.one_axis_tc_or_rlf(spikeTimestamps, eventOnsetTimes, freqEachTrial, timeRange=timeRange)
        ax = plt.gca()
        ax.set_xticks(range(len(freqLabels)))
        ax.set_xticklabels(freqLabels, rotation='vertical')
开发者ID:sjara,项目名称:jaratoolbox,代码行数:25,代码来源:ephysinterface.py


示例12: plot_distribution

def plot_distribution(nx_graph, filename):
    """
    Plots the in/out degree distribution of the Graph

    :rtype : None
    :param nx_graph: nx.Digraph() - Directed NetworkX Graph
    :param filename: String - Name of the file to save the plot
    """
    in_degrees = nx_graph.in_degree()
    in_values = sorted(set(in_degrees.values()))

    out_degrees = nx_graph.out_degree()
    out_values = sorted(set(out_degrees.values()))

    in_hist = [in_degrees.values().count(x) for x in in_values]
    out_hist = [out_degrees.values().count(x) for x in out_values]

    plt.clf()
    plt.cla()
    plt.figure()
    plt.plot(in_values, in_hist,'ro-') # in-degree
    plt.plot(out_values, out_hist,'bv-') # out-degree
    # plt.yscale('log')
    plt.legend(['In-degree','Out-degree'])
    plt.xlabel('Degree')
    plt.ylabel('Number of nodes')
    plt.title('In-Out Degree Distribution')
    plt.savefig(filename + '.png', format='png')
    plt.close()
开发者ID:BeifeiZhou,项目名称:social-network-recommendation,代码行数:29,代码来源:utilities.py


示例13: plot_skus

def plot_skus(data, plot_name, save=True):
    import matplotlib as mpl
    mpl.use('Agg')
    import matplotlib.pyplot as plt
    import matplotlib.dates as mdates
    q = data['q']
    p = data['ppr']
    flag = data['promo_flag']
    np = data['npr']

    fig, ax = plt.subplots(figsize=(15,8))
    q.plot(ax=ax, grid=True, color='black')
    p.plot(ax=ax, secondary_y=True, grid=True, color='red')
    np.plot(ax=ax, secondary_y=True, grid=True, color='gray')
    flag.plot(ax=ax, secondary_y=True, grid=True, color='blue')
    ax.xaxis.set_major_locator(mdates.MonthLocator(interval=2))
    ax.set_ylabel(q.name)
    ax.right_ax.set_ylabel(p.name)
    fig.autofmt_xdate()
    ax.legend()
    fig.tight_layout()
    fig.savefig(plot_name)
    plt.close(fig)
    plt.cla()
    return None
开发者ID:cby6,项目名称:hello-world,代码行数:25,代码来源:plot_skus.py


示例14: kinect3DPlotDemo

def kinect3DPlotDemo():
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    plt.ion()
    plt.show()

    openni2.initialize()
    dev = openni2.Device.open_any()
    ds = dev.create_depth_stream()
    ds.start()

    while(1):
        f = ds.read_frame().get_buffer_as_uint16()
        a = np.ndarray((480,640),dtype=np.uint16,buffer=f)
        ipts = []
        for y in range(180, 300, 20):
            for x in range(260, 380, 20):
                ipts.append((x, y, a[y][x]))
        m = np.matrix(ipts).T
        fpts = rwCoordsFromKinect(m) #get real world coordinates
        plt.cla()
        ax.scatter([pt[0] for pt in fpts], [pt[1] for pt in fpts], [pt[1] for pt in fpts], color='r')
        plt.draw()

        p = planeFromPts(np.matrix(random.sample(fpts, 3))) #fit a plane to these points
        print p
        plt.pause(.1)
开发者ID:beccaelenzil,项目名称:AdvCS_BV,代码行数:27,代码来源:Demos.py


示例15: run_test

def run_test(name, i):
    global RE
    RE = reynolds[i]
    global MAX_ITERS
    MAX_ITERS = max_iters[i]
    basepath = os.path.join('results', name, 're%s' % RE)
    if not os.path.exists(basepath):
        os.makedirs(basepath)

    ctrl = LBSimulationController(TestLDCSim, TestLDCGeometry)
    ctrl.run()
    horiz = np.loadtxt('ldc_golden/vx2d', skiprows=4)
    vert = np.loadtxt('ldc_golden/vy2d', skiprows=4)

    plt.plot(horiz[:, 0] * 2 - 1, horiz[:, i+1], label='Paper')
    plt.plot(vert[:, i+1], 2 * (vert[:, 0] - 0.5), label='Paper')
    save_output(basepath)
    plt.legend(loc='lower right')
    plt.gca().yaxis.grid(True)
    plt.gca().xaxis.grid(True)
    plt.gca().xaxis.grid(True, which='minor')
    plt.gca().yaxis.grid(True, which='minor')

    plt.title('Lid Driven Cavity, Re = %s' % RE)
    print os.path.join(basepath, 'results.pdf')
    plt.savefig(os.path.join(basepath, 'results.pdf'), format='pdf')

    plt.clf()
    plt.cla()
    plt.show()
开发者ID:Mokosha,项目名称:sailfish,代码行数:30,代码来源:ldc_2d.py


示例16: print_progress

def print_progress(self, t, losses, sess):
    if t % self.n_print == 0:
        print("iter %d loss %.2f " % (t, np.mean(losses)))
        self.variational.print_params(sess)

        # Sample functions from variational model
        mean, std = sess.run([self.variational.m, self.variational.s])
        rs = np.random.RandomState(0)
        zs = rs.randn(10, self.variational.num_vars) * std + mean
        zs = tf.constant(zs, dtype=tf.float32)
        inputs = np.linspace(-3, 3, num=400, dtype=np.float32)
        x = tf.expand_dims(tf.constant(inputs), 1)
        mus = tf.pack([self.model.mapping(x, z) for z in tf.unpack(zs)])
        outputs = sess.run(mus)

        # Get data
        y, x = sess.run([self.data.data[:, 0], self.data.data[:, 1]])

        # Plot data and functions
        plt.cla()
        ax.plot(x, y, 'bx')
        ax.plot(inputs, outputs.T)
        ax.set_xlim([-3, 3])
        ax.set_ylim([-0.5, 1.5])
        plt.draw()
开发者ID:ShuaiW,项目名称:edward,代码行数:25,代码来源:hierarchical_logistic_regression.py


示例17: make_plot

def make_plot(choice):
    """ Three options: growing, decaying, flat """

    choice_f = flat

    if choice is "growing":
        choice_f = grow
    elif choice is "decaying":
        choice_f = decay

    ys = [choice_f(x) * np.sin(np.pi * x) for x in xs]
    upper_bounds = np.array([choice_f(x) for x in xs])
    lower_bounds = upper_bounds * -1

    plot.plot(xs, ys, "b", linewidth=linewidth + 1)
    plot.plot(xs, upper_bounds, "r", linewidth=linewidth)
    plot.plot(xs, lower_bounds, "r", linewidth=linewidth)

    # Limit
    plot.ylim(-3, 3)

    # Annotate
    plot.xlabel("Time", fontsize=fontsize)
    plot.ylabel(r"$\delta \Sigma$", fontsize=fontsize + 5)
    plot.title("", fontsize=fontsize + 1)

    # Save and Close
    plot.savefig("%s_mode.png" % choice)
    plot.show()
    plot.cla()
开发者ID:Sportsfan77777,项目名称:vortex,代码行数:30,代码来源:bounded_waves.py


示例18: plotHistory

	def plotHistory(self,name=''):
		"""
		permet une sauvegarde graphique de l'evolution de la population
		au fil des generations.
		@param name: chaine de caracteres pour le fichier de sortie
		"""
		from os.path import exists, isdir
		_base = 'datas'
		if exists(_base) and isdir(_base): _fmt = _base + '/'
		else: _fmt = ''
			
		_fmt += 'graph%s_%s_%d-%d'
		_name = _fmt % (name,self.alphabet,self.szPop,self.age)

		if HASPLOT:
			_max = self.bestEval
			plt.axis([0, self.age, 0, _max*1.5]) #axes du graphe
			for i,_lab in enumerate( ('min','moy','max') ):
				datas = [ self.history[_][0][i] for _ in range(self.age) ]
				# datas = [ self.history[_][i] for _ in range(self.age) ]
				plt.plot(datas,label=_lab)
			_label='%s, pop : %d, bestfitness : %2.3f (age %s) ' %\
					(name,self.szPop,self.bestEval,self.quand)
			plt.title(_label)
			plt.legend()
			# plt.show()
			plt.savefig(_name)      #sauvegarde du graphe
			print( 'sauvegarde dans',_name )
			plt.cla()       #efface les axes du graphe

		else:
			print( 'no plotting output available' )
开发者ID:borjanG,项目名称:IA-Vacuum,代码行数:32,代码来源:agslib.py


示例19: print_A_phi_lsld

    def print_A_phi_lsld(self, S, mua, musp, xsrc, zsrc, phi0, root, w, s):
        #print S/1.e9
        ls = self.ls
        ld = self.ld
        g = self.func(S, mua, musp, ls, ld, self.Xdet, self.Zdet, self.slab_d, xsrc, zsrc, self.seriessum, self.wbyv)
        r = np.sqrt(self.slab_d**2 + (self.Xdet - xsrc)**2 + (self.Zdet - zsrc)**2)
        alnrA = np.log(np.abs(g)*r)
        dlnrA = np.log(self.Amp*r)

        filename = "lnrA_lsld_%s_%d.png" % (w, s)
        plt.cla()
        plt.plot(r, dlnrA, 'b,', label='Data')
        plt.plot(r, alnrA, 'r.', label='Fit')
        plt.xlabel(r'$r$ (mm)')
        plt.ylabel(r'$\log(rA)$')
        plt.title("%s (w=%s, s=%d)"%(root, w, s))
        plt.legend()
        plt.savefig(filename)

        filename = "phi_lsld_%s_%d.png" % (w, s)
        plt.cla()
        plt.plot(r, self.Pha, 'b,', label='Data')
        plt.plot(r, np.angle(g)+phi0, 'r.', label='Fit')
        plt.xlabel('$r$ (mm)')
        plt.ylabel(r'$\phi$ (radian)')
        plt.title("%s (w=%s, s=%d)"%(root, w, s))
        plt.legend()
        plt.savefig(filename)

        filename = "dat_lsld_%s_%d.txt" % (w, s)
        r = self.dIdx.astype(int)/int(self.amshape[0])
        c = self.dIdx.astype(int)%int(self.amshape[0])
        d = np.vstack((self.dIdx, r, c, self.Xdet, self.Zdet, self.Amp, self.Pha)).T
        #np.savetxt(filename, d, fmt='%.0f %.0f %.0f %f %f %f %f', header="index row col xpos zpos Amp Pha")
        np.savetxt(filename, d, fmt='%.0f %.0f %.0f %f %f %f %f')
开发者ID:Venki-Kavuri,项目名称:bopy,代码行数:35,代码来源:InfSlab1.py


示例20: callback

        def callback():
            request = self.pipe.recv()
            if request is None:
                return False
#            self.fig.suptitle('t={:.8f}'.format(request.t))
            for n,f in enumerate(request.flist):
                ax=self.axes[n]
                self.fig.sca(ax)
                plt.cla()
#                ax.set_title(mp.component_name(self.components[n]) + ' @ t={:.2f} )
                ax.set_title(r'$|E|^2, t={:.2f}$'.format(request.t))
                ax.set_xlabel(r'$x$')
                ax.set_ylabel(r'$y$')
#mp.component_name(self.components[n]) + ' @ t={:.2f} )
#                cb=self.cbs[n]
#                clim = cb.get_clim()
                f=f*f
                if not self.fix_clim:
                    self.clim[0] = min(self.clim[0],np.amin(f))
                    self.clim[1] = max(self.clim[1],np.amax(f))
                img = ax.contourf(self.X,self.Y,np.transpose(f),
                                  self.num_contours, cmap=self.cmap,
                                  vmin=self.clim[0],vmax=self.clim[1])
                ax.set_aspect('equal')
                self.cbs[n]=self.fig.colorbar(img, cax=self.cbs[n].ax)
                self.cbs[n].set_clim(self.clim[0],self.clim[1])
                self.cbs[n].set_ticks(np.linspace(self.clim[0],self.clim[1],3))
                self.cbs[n].draw_all()
            self.fig.canvas.draw()
            return True
开发者ID:oskooi,项目名称:meep,代码行数:30,代码来源:Visualization.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pyplot.clabel函数代码示例发布时间:2022-05-27
下一篇:
Python pyplot.boxplot函数代码示例发布时间: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