python类grid()的实例源码

disp_mp3.py 文件源码 项目:audio_scripts 作者: audiofilter 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def display_wav(filename):
    input_data = read(filename)
    audio_in = input_data[1]
    samples = len(audio_in)
    fig = pylab.figure();
    print samples/44100.0," seconds"
    k = 0
    plot_data_out = []
    for i in xrange(samples):
        plot_data_out.append(audio_in[k]/32768.0)
        k = k+1
    pdata = numpy.array(plot_data_out, dtype=numpy.float)
    pylab.plot(pdata)
    pylab.grid(True)
    pylab.ion()
    pylab.show()
snaketools.py 文件源码 项目:sequana 作者: sequana 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def plot(self, fontsize=16):
        """Create the barplot from the stats file"""
        from sequana.lazy import pylab
        from sequana.lazy import pandas as pd
        pylab.clf()
        df = pd.DataFrame(self._parse_data()['rules'])
        ts = df.ix['mean-runtime']
        total_time = df.ix['mean-runtime'].sum()
        #ts['total'] = self._parse_data()['total_runtime'] / float(self.N)
        ts['total'] = total_time
        ts.sort_values(inplace=True)

        ts.plot.barh(fontsize=fontsize)
        pylab.grid(True)
        pylab.xlabel("Seconds (s)", fontsize=fontsize)
        try:
            pylab.tight_layout()
        except:
            pass
rectify.py 文件源码 项目:facade-segmentation 作者: jfemiani 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def plot_rectified(self):
        import pylab
        pylab.title('rectified')
        pylab.imshow(self.rectified)

        for line in self.vlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0)
rectify.py 文件源码 项目:facade-segmentation 作者: jfemiani 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def plot_original(self):
        import pylab
        pylab.title('original')
        pylab.imshow(self.data)

        for line in self.lines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='blue', alpha=0.3)

        for line in self.vlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0)
Interaction.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def plotPopScore(population, fitness=False):
   """ Plot the population score distribution

   Example:
      >>> Interaction.plotPopScore(population)

   :param population: population object (:class:`GPopulation.GPopulation`)
   :param fitness: if True, the fitness score will be used, otherwise, the raw.
   :rtype: None

   """
   score_list = getPopScores(population, fitness)
   pylab.plot(score_list, 'o')
   pylab.title("Plot of population score distribution")
   pylab.xlabel('Individual')
   pylab.ylabel('Score')
   pylab.grid(True)
   pylab.show()

# -----------------------------------------------------------------
Interaction.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def plotHistPopScore(population, fitness=False):
   """ Population score distribution histogram

   Example:
      >>> Interaction.plotHistPopScore(population)

   :param population: population object (:class:`GPopulation.GPopulation`)
   :param fitness: if True, the fitness score will be used, otherwise, the raw.
   :rtype: None

   """
   score_list = getPopScores(population, fitness)
   n, bins, patches = pylab.hist(score_list, 50, facecolor='green', alpha=0.75, normed=1)
   pylab.plot(bins, pylab.normpdf(bins, numpy.mean(score_list), numpy.std(score_list)), 'r--')
   pylab.xlabel('Score')
   pylab.ylabel('Frequency')
   pylab.grid(True)
   pylab.title("Plot of population score distribution")
   pylab.show()

# -----------------------------------------------------------------
Interaction.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def plotPopScore(population, fitness=False):
   """ Plot the population score distribution

   Example:
      >>> Interaction.plotPopScore(population)

   :param population: population object (:class:`GPopulation.GPopulation`)
   :param fitness: if True, the fitness score will be used, otherwise, the raw.
   :rtype: None

   """
   score_list = getPopScores(population, fitness)
   pylab.plot(score_list, 'o')
   pylab.title("Plot of population score distribution")
   pylab.xlabel('Individual')
   pylab.ylabel('Score')
   pylab.grid(True)
   pylab.show()

# -----------------------------------------------------------------
Interaction.py 文件源码 项目:CAAPR 作者: Stargrazer82301 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def plotHistPopScore(population, fitness=False):
   """ Population score distribution histogram

   Example:
      >>> Interaction.plotHistPopScore(population)

   :param population: population object (:class:`GPopulation.GPopulation`)
   :param fitness: if True, the fitness score will be used, otherwise, the raw.
   :rtype: None

   """
   score_list = getPopScores(population, fitness)
   n, bins, patches = pylab.hist(score_list, 50, facecolor='green', alpha=0.75, normed=1)
   pylab.plot(bins, pylab.normpdf(bins, numpy.mean(score_list), numpy.std(score_list)), 'r--')
   pylab.xlabel('Score')
   pylab.ylabel('Frequency')
   pylab.grid(True)
   pylab.title("Plot of population score distribution")
   pylab.show()

# -----------------------------------------------------------------
quotes.py 文件源码 项目:GLaDOS2 作者: TheComet 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def plot_word_frequencies(freq, user):
        samples = [item for item, _ in freq.most_common(50)]

        freqs = np.array([float(freq[sample]) for sample in samples])
        freqs /= np.max(freqs)

        ylabel = "Normalized word count"

        pylab.grid(True, color="silver")
        kwargs = dict()
        kwargs["linewidth"] = 2
        kwargs["label"] = user
        pylab.plot(freqs, **kwargs)
        pylab.xticks(range(len(samples)), [nltk.compat.text_type(s) for s in samples], rotation=90)
        pylab.xlabel("Samples")
        pylab.ylabel(ylabel)
        pylab.gca().set_yscale('log', basey=2)
4(improved-7).py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def show_results(self):
        pl.plot(self.t1, self.n_A1, 'b--', label='A1: Time Step = 0.05')
        pl.plot(self.t1, self.n_B1, 'b', label='B1: Time Step = 0.05')
        pl.plot(self.t2, self.n_A2, 'g--', label='A2: Time Step = 0.1')
        pl.plot(self.t2, self.n_B2, 'g', label='B2: Time Step = 0.1')
        pl.plot(self.t1, self.n_A1_true, 'r--', label='True A1: Time Step = 0.05')
        pl.plot(self.t1, self.n_B1_true, 'r', label='True B1: Time Step = 0.05')
        pl.plot(self.t2, self.n_A2_true, 'c--', label='True A2: Time Step = 0.1')
        pl.plot(self.t2, self.n_B2_true, 'c', label='True B2: Time Step = 0.1')
        pl.title('Double Decay Probelm-Approximation Compared with True in Defferent Time Steps')
        pl.xlim(0.0, 0.1)
        pl.ylim(0.0, 100.0)
        pl.xlabel('time ($s$)')
        pl.ylabel('Number of Nuclei')
        pl.legend(loc='best', shadow=True, fontsize='small')
        pl.grid(True)
        pl.savefig("computational_physics homework 4(improved-7).png")
6 code.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def show_simple(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 16,
        }
        pl.title('The Trajectory of Tageted Baseball\n with air flow in adiabatic model', fontdict = font)
        pl.plot(self.x, self.y, label ='$\\alpha = %.0f \degree$'%self.alpha)
        pl.xlabel('x $m$')
        pl.ylabel('y $m$')
        pl.xlim(0, 400)
        pl.ylim(-100, 200)
        pl.grid()
        pl.legend(loc = 'upper right', shadow = True, fontsize = 'medium')
        pl.text(5, -80, 'trojectories varing with angles of wind', fontdict = font)
        pl.show()
5 code 1.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 14,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(41, 16, 'Only with air drag', fontdict = font)
        pl.show()
5 code 2.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34, 16, '       With both air drag and \n reduced air density-isothermal', fontdict = font)
        pl.show()
5 code 4.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34.5, 16, '      With air drag and the \n dependence of g on altitude', fontdict = font)
        pl.show()
5 code 3.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def show_results(self):
        font = {'family': 'serif',
                'color':  'k',
                'weight': 'normal',
                'size': 12,
        }
        pl.plot(self.x, self.y, 'c', label='firing angle = 45°')
        pl.title('The Trajectory of a Cannon Shell', fontdict = font)
        pl.xlabel('x (k$m$)')
        pl.ylabel('y ($km$)')
        pl.xlim(0, 60)
        pl.ylim(0, 20)
        pl.grid(True)
        pl.legend(loc='upper right', shadow=True, fontsize='large')
        pl.text(34.5, 16, '       With both air drag and \n reduced air density-adiabatic', fontdict = font)
        pl.show()
ui.py 文件源码 项目:autoxd 作者: nessessary 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def DrawDvs(pl, closes, curve, sign, dvs, pandl, sh, title, leag=None, lad=None ):
    pl.figure
    pl.subplot(311)
    pl.title("id:%s Sharpe ratio: %.2f"%(str(title),sh))
    pl.plot(closes)
    DrawLine(pl, sign, closes)
    pl.subplot(312)
    pl.grid()
    if dvs != None:
        pl.plot(dvs)
    if isinstance(curve, np.ndarray):
        DrawZZ(pl, curve, 'r')
    if leag != None:
        pl.plot(leag, 'r')
    if lad != None:
        pl.plot(lad, 'b')
    #pl.plot(stock.GuiYiHua(closes[:i])[60:])
    pl.subplot(313)
    pl.plot(sign)
    pl.plot(pandl)
    pl.show()
    pl.close()
ui.py 文件源码 项目:autoxd 作者: nessessary 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def DrawDvsAndZZ(pl, dvs, zz, closes=None):
    """dvs?zz??????; dvs : ????closes, """
    dvs = np.array(dvs)
    pl.figure
    if closes == None:
        pl.plot(dvs)
        pl.plot(zz[:,0], zz[:,1], 'r')
    else:
        pl.subplot(211)
        pl.plot(closes)
        pl.grid()
        pl.subplot(212)
        pl.grid()
        pl.plot(dvs)
        pl.plot(zz[:,0], zz[:,1], 'r')
    pl.show()
    pl.close()
EllipseFit.py 文件源码 项目:msnoise-tomo 作者: ThomasLecocq 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def elltest(scale=0.8,off=0.2):
    #generate an example, random, non-self-intersecting polygon.
    #This is done by first generating
    #it in polar coordinates and than translating it
    #to cartesian.
    Theta1,R1=linspace(0,2*pi,30),rand(30)*scale+off
    X1,Y1=R1*cos(Theta1),R1*sin(Theta1)
    X1=append(X1,X1[0])
    Y1=append(Y1,Y1[0])

    p.plot(X1,Y1,".-",ms=10)


    a2,b2,ecc2,alpha2=ellfit(X1,Y1,showFig=False)

    Xe,Ye=ellipse(b2,a2,-alpha2,X1.mean(),Y1.mean(),Nb=40)

    p.plot(Xe,Ye,"r.-")


    p.grid(True)
    p.show()
    pass
pyroc.py 文件源码 项目:bokeh_roc_slider 作者: brianray 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def plot(self,title='',include_baseline=False,equal_aspect=True):
        """ Method that generates a plot of the ROC curve
            Parameters:
                title: Title of the chart
                include_baseline: Add the baseline plot line if it's True
                equal_aspect: Aspects to be equal for all plot
        """

        pylab.clf()
        pylab.plot([x[0] for x in self.derived_points], [y[1] for y in self.derived_points], self.linestyle)
        if include_baseline:
            pylab.plot([0.0,1.0], [0.0,1.0],'k-.')
        pylab.ylim((0,1))
        pylab.xlim((0,1))
        pylab.xticks(pylab.arange(0,1.1,.1))
        pylab.yticks(pylab.arange(0,1.1,.1))
        pylab.grid(True)
        if equal_aspect:
            cax = pylab.gca()
            cax.set_aspect('equal')
        pylab.xlabel('1 - Specificity')
        pylab.ylabel('Sensitivity')
        pylab.title(title)

        pylab.show()
data_visualization.py 文件源码 项目:Oedipus 作者: tum-i22 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def plotAccuracyGraph(X, Y, Xlabel='Variable', Ylabel='Accuracy', graphTitle="Test Accuracy Graph", filename="graph.pdf"):
    """ Plots and saves accuracy graphs """
    try:
        timestamp = int(time.time())
        fig = P.figure(figsize=(8,5))
        # Set the graph's title
        P.title(graphTitle, fontname='monospace')
        # Set the axes labels
        P.xlabel(Xlabel, fontsize=12, fontname='monospace')
        P.ylabel(Ylabel, fontsize=12, fontname='monospace')
        # Add horizontal and vertical lines to the graph
        P.grid(color='DarkGray', linestyle='--', linewidth=0.1, axis='both')
        # Add the data to the graph
        P.plot(X, Y, 'r-*', linewidth=1.0)
        # Save figure
        prettyPrint("Saving figure to ./%s" % filename)#(graphTitle.replace(" ","_"), timestamp))
        P.tight_layout()
        fig.savefig("./%s" % filename)#(graphTitle.replace(" ", "_"), timestamp))

    except Exception as e:
        prettyPrint("Error encountered in \"plotAccuracyGraph\": %s" % e, "error")
        return False

    return True
disp_mp3.py 文件源码 项目:audio_scripts 作者: audiofilter 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def plot_sum_data(sum_data):
    pdata = numpy.array(sum_data, dtype=numpy.int16)
    pylab.figure()
    pylab.plot(pdata)
    pylab.grid(True)
    pylab.show()
turbine.py 文件源码 项目:siren 作者: ozsolarwind 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def PowerCurve(self):
        """plot power curve."""
        plt.plot(self.speeds, self.powers, linewidth=2.0)
        plt.title('Power Curve for ' + self.name)
        plt.grid(True)
        plt.xlabel('wind speed (m/s)')
        plt.ylabel('generation (kW)')
        plt.show(block=True)
plotweather.py 文件源码 项目:siren 作者: ozsolarwind 项目源码 文件源码 阅读 51 收藏 0 点赞 0 评论 0
def initUI(self):
        self.grid = QtGui.QGridLayout()
        self.checkbox = []
        i = 0
        bold = QtGui.QFont()
        bold.setBold(True)
        for plot in range(len(self.plot_order)):
            if self.plot_order[plot] in self.spacers:
                label = QtGui.QLabel(self.spacers[self.plot_order[plot]])
                label.setFont(bold)
                self.grid.addWidget(label, i, 0)
                i += 1
            self.checkbox.append(QtGui.QCheckBox(self.hdrs[self.plot_order[plot]], self))
            if self.plots[self.plot_order[plot]]:
                self.checkbox[plot].setCheckState(QtCore.Qt.Checked)
            self.grid.addWidget(self.checkbox[-1], i, 0)
            i += 1
        self.grid.connect(self.checkbox[0], QtCore.SIGNAL('stateChanged(int)'), self.check_all)
        show = QtGui.QPushButton('Proceed', self)
        show.clicked.connect(self.showClicked)
        self.grid.addWidget(show, i, 0)
        frame = QtGui.QFrame()
        frame.setLayout(self.grid)
        self.scroll = QtGui.QScrollArea()
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(frame)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.scroll)
        commnt = QtGui.QLabel('Nearest weather files:\n' + self.comment)
        self.layout.addWidget(commnt)
        self.setWindowTitle('SIREN - Weather dialog for ' + str(self.base_year))
        QtGui.QShortcut(QtGui.QKeySequence('q'), self, self.quitClicked)
        self.show_them = False
        self.show()
powermodel.py 文件源码 项目:siren 作者: ozsolarwind 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def initUI(self):
        self.chosen = []
        self.grid = QtGui.QGridLayout()
        self.checkbox = []
        self.checkbox.append(QtGui.QCheckBox('Check / Uncheck all', self))
        self.grid.addWidget(self.checkbox[-1], 0, 0)
        i = 0
        c = 0
        icons = Icons()
        for stn in sorted(self.stations, key=lambda station: station.name):
            if stn.technology[:6] == 'Fossil' and not self.actual:
                continue
            if stn.technology == 'Rooftop PV' and stn.scenario == 'Existing' and not self.gross_load:
                continue
            self.checkbox.append(QtGui.QCheckBox(stn.name, self))
            icon = icons.getIcon(stn.technology)
            if icon != '':
                self.checkbox[-1].setIcon(QtGui.QIcon(icon))
            i += 1
            self.grid.addWidget(self.checkbox[-1], i, c)
            if i > 25:
                i = 0
                c += 1
        self.grid.connect(self.checkbox[0], QtCore.SIGNAL('stateChanged(int)'), self.check_all)
        show = QtGui.QPushButton('Choose', self)
        self.grid.addWidget(show, i + 1, c)
        show.clicked.connect(self.showClicked)
        self.setLayout(self.grid)
        self.setWindowTitle('SIREN - Power Stations dialog')
        QtGui.QShortcut(QtGui.QKeySequence('q'), self, self.quitClicked)
        self.show_them = False
        self.show()
plots.py 文件源码 项目:multi-contact-zmp 作者: stephane-caron 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def plot_com(self):
        pylab.plot(
            [-p[1] for p in self.com_real], [p[0] for p in self.com_real],
            'g-', lw=2)
        pylab.plot(
            [-p[1] for p in self.com_ref], [p[0] for p in self.com_ref],
            'k--', lw=1)
        pylab.legend(('$p_G$', '$p_G^{ref}$'), loc='upper right')
        pylab.grid(False)
        pylab.xlim(self.xlim)
        pylab.ylim(self.ylim)
        pylab.xlabel(self.xlabel)
        pylab.ylabel(self.ylabel)
        pylab.title("COM trajectory")
plots.py 文件源码 项目:multi-contact-zmp 作者: stephane-caron 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def plot_zmp(self):
        pylab.plot(
            [-p[1] for p in self.zmp_real], [p[0] for p in self.zmp_real],
            'r-', lw=2)
        pylab.plot(
            [-p[1] for p in self.zmp_ref], [p[0] for p in self.zmp_ref],
            'k--', lw=1)
        pylab.legend(('$p_Z$', '$p_Z^{ref}$'), loc='upper right')
        pylab.grid(False)
        pylab.xlim(self.xlim)
        pylab.ylim(self.ylim)
        pylab.xlabel(self.xlabel)
        pylab.ylabel(self.ylabel)
        pylab.title("ZMP trajectory")
tests.py 文件源码 项目:dynamic-walking 作者: stephane-caron 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_dT_impact(xvals, f, nmpc, sim, start=0.1, end=0.8, step=0.02, ymax=200,
                   sample_size=100, label=None):
    """Used to generate Figure XX of the paper."""
    c = raw_input("Did you remove iter/time caps in IPOPT settings? [y/N] ")
    if c.lower() not in ['y', 'yes']:
        print "Then go ahead and do it."
        return
    stats = [Statistics() for _ in xrange(len(xvals))]
    fails = [0. for _ in xrange(len(xvals))]
    pylab.ion()
    pylab.clf()
    for (i, dT) in enumerate(xvals):
        f(dT)
        for _ in xrange(sample_size):
            nmpc.on_tick(sim)
            if 'Solve' in nmpc.nlp.return_status:
                stats[i].add(nmpc.nlp.solve_time)
            else:  # max CPU time exceeded, infeasible problem detected, ...
                fails[i] += 1.
    yvals = [1000 * ts.avg if ts.avg is not None else 0. for ts in stats]
    yerr = [1000 * ts.std if ts.std is not None else 0. for ts in stats]
    pylab.bar(
        xvals, yvals, width=step, yerr=yerr, color='y', capsize=5,
        align='center', error_kw={'capsize': 5, 'elinewidth': 5})
    pylab.xlim(start - step / 2, end + step / 2)
    pylab.ylim(0, ymax)
    pylab.grid(True)
    if label is not None:
        pylab.xlabel(label, fontsize=24)
    pylab.ylabel('Comp. time (ms)', fontsize=20)
    pylab.tick_params(labelsize=16)
    pylab.twinx()
    yfails = [100. * fails[i] / sample_size for i in xrange(len(xvals))]
    pylab.plot(xvals, yfails, 'ro', markersize=12)
    pylab.plot(xvals, yfails, 'r--', linewidth=3)
    pylab.xlim(start - step / 2, end + step / 2)
    pylab.ylabel("Failure rate [%]", fontsize=20)
    pylab.tight_layout()
4(improved-5).py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 42 收藏 0 点赞 0 评论 0
def show_results(self):
        pl.plot(self.t1, self.n_A1, 'b--', label='A1, Time Step = 0.05')
        pl.plot(self.t1, self.n_B1, 'b', label='B1, Time Step = 0.05')
        pl.plot(self.t2, self.n_A2, 'g--', label='A2, Time Step = 0.01')
        pl.plot(self.t2, self.n_B2, 'g', label='B2, Time Step = 0.01')
        pl.plot(self.t3, self.n_A3, 'r--', label='A3, Time Step = 0.1')
        pl.plot(self.t3, self.n_B3, 'r', label='B3, Time Step = 0.1')
        pl.title('Double Decay Probelm-Three Time Steps')
        pl.xlim(0.0, 2.5)
        pl.ylim(0.0, 100.0)
        pl.xlabel('time ($s$)')
        pl.ylabel('Number of Nuclei')
        pl.legend(loc='best', shadow=True, fontsize='small')
        pl.grid(True)
4(improved-10) 2.py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def show_results(self):
        pl.plot(self.t, self.n_A, 'b--', label='Number of Nuclei A')
        pl.plot(self.t, self.n_B, 'b', label='Number of Nuclei B')
        pl.plot(self.t, self.n_A_true, 'g--', label='True Number of Nuclei A')
        pl.plot(self.t, self.n_B_true, 'g', label='True Number of Nuclei B')
        pl.title('Double Decay Probelm-Approximation Compared with True')
        pl.xlim(0.0, 2.5)
        pl.ylim(0.0, 100.0)
        pl.xlabel('time ($s$)')
        pl.ylabel('Number of Nuclei')
        pl.legend(loc='best', shadow=True)
        pl.grid(True)
4(improved-6).py 文件源码 项目:computational_physics_N2014301020117 作者: yukangnineteen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def show_results(self):
        pl.plot(self.t, self.n_A, 'b--', label='Number of Nuclei A')
        pl.plot(self.t, self.n_B, 'b', label='Number of Nuclei B')
        pl.plot(self.t, self.n_A_true, 'g--', label='True Number of Nuclei A')
        pl.plot(self.t, self.n_B_true, 'g', label='True Number of Nuclei B')
        pl.title('Double Decay Probelm-Approximation Compared with True')
        pl.xlim(0.0, 2.5)
        pl.ylim(0.0, 100.0)
        pl.xlabel('time ($s$)')
        pl.ylabel('Number of Nuclei')
        pl.legend(loc='best', shadow=True)
        pl.grid(True)


问题


面经


文章

微信
公众号

扫码关注公众号