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


Python pylab.title方法代码示例

本文整理汇总了Python中pylab.title方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.title方法的具体用法?Python pylab.title怎么用?Python pylab.title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pylab的用法示例。


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

示例1: plot_confusion_matrix

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_confusion_matrix(y_true, y_pred, size=None, normalize=False):
    """plot_confusion_matrix."""
    cm = confusion_matrix(y_true, y_pred)
    fmt = "%d"
    if normalize:
        cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
        fmt = "%.2f"
    xticklabels = list(sorted(set(y_pred)))
    yticklabels = list(sorted(set(y_true)))
    if size is not None:
        plt.figure(figsize=(size, size))
    heatmap(cm, xlabel='Predicted label', ylabel='True label',
            xticklabels=xticklabels, yticklabels=yticklabels,
            cmap=plt.cm.Blues, fmt=fmt)
    if normalize:
        plt.title("Confusion matrix (norm.)")
    else:
        plt.title("Confusion matrix")
    plt.gca().invert_yaxis() 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:21,代码来源:__init__.py

示例2: plot_roc_curve

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_roc_curve(y_true, y_score, size=None):
    """plot_roc_curve."""
    false_positive_rate, true_positive_rate, thresholds = roc_curve(
        y_true, y_score)
    if size is not None:
        plt.figure(figsize=(size, size))
        plt.axis('equal')
    plt.plot(false_positive_rate, true_positive_rate, lw=2, color='navy')
    plt.plot([0, 1], [0, 1], color='gray', lw=1, linestyle='--')
    plt.xlabel('False positive rate')
    plt.ylabel('True positive rate')
    plt.ylim([-0.05, 1.05])
    plt.xlim([-0.05, 1.05])
    plt.grid()
    plt.title('Receiver operating characteristic AUC={0:0.2f}'.format(
        roc_auc_score(y_true, y_score))) 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:18,代码来源:__init__.py

示例3: plot_learning_curve

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_learning_curve(train_sizes, train_scores, test_scores):
    """plot_learning_curve."""
    plt.figure(figsize=(15, 5))
    plt.title('Learning Curve')
    plt.xlabel("Training examples")
    plt.ylabel("AUC ROC")
    tr_ys = compute_stats(train_scores)
    te_ys = compute_stats(test_scores)
    plot_stats(train_sizes, tr_ys,
               label='Training score',
               color='navy')
    plot_stats(train_sizes, te_ys,
               label='Cross-validation score',
               color='orange')
    plt.grid(linestyle=":")
    plt.legend(loc="best")
    plt.show() 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:19,代码来源:estimator_utils.py

示例4: __init__

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def __init__(self, add_inputs, title='', **kwargs):
        super(OffshorePlot, self).__init__(**kwargs)
        self.fig = plt.figure(num=None, facecolor='w', edgecolor='k') #figsize=(13, 8), dpi=1000
        self.shape_plot = self.fig.add_subplot(121)
        self.objf_plot = self.fig.add_subplot(122)

        self.targname = add_inputs
        self.title = title

        # Adding automatically the inputs
        for i in add_inputs:
            self.add(i, Float(0.0, iotype='in'))

        #sns.set(style="darkgrid")
        #self.pal = sns.dark_palette("skyblue", as_cmap=True)
        plt.rc('lines', linewidth=1)
        plt.ion()
        self.force_execute = True
        if not pa('fig').exists():
            pa('fig').mkdir() 
开发者ID:DTUWindEnergy,项目名称:TOPFARM,代码行数:22,代码来源:plot.py

示例5: generate

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def generate(self, filename, show=True):
        '''Generate a sample sequence, plot the resulting piano-roll and save
        it as a MIDI file.
        filename : string
            A MIDI file will be created at this location.
        show : boolean
            If True, a piano-roll of the generated sequence will be shown.'''

        piano_roll = self.generate_function()
        midiwrite(filename, piano_roll, self.r, self.dt)
        if show:
            extent = (0, self.dt * len(piano_roll)) + self.r
            pylab.figure()
            pylab.imshow(piano_roll.T, origin='lower', aspect='auto',
                         interpolation='nearest', cmap=pylab.cm.gray_r,
                         extent=extent)
            pylab.xlabel('time (s)')
            pylab.ylabel('MIDI note number')
            pylab.title('generated piano-roll') 
开发者ID:feynmanliang,项目名称:bachbot,代码行数:21,代码来源:rnnrbm.py

示例6: plot_it

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_it():
    '''
    helper function to gain insight on provided data sets background,
    using pylab
    '''
    data1 = [[1.0, 1], [2.25, 3.5], [3.58333333333, 7.5], [4.95833333333, 13.0], [6.35833333333, 20.0], [7.775, 28.5], [9.20357142857, 38.5], [10.6410714286, 50.0], [12.085515873, 63.0], [13.535515873, 77.5]]
    data2 = [[1.0, 1], [1.75, 2.5], [2.41666666667, 4.5], [3.04166666667, 7.0], [3.64166666667, 10.0], [4.225, 13.5], [4.79642857143, 17.5], [5.35892857143, 22.0], [5.91448412698, 27.0], [6.46448412698, 32.5], [7.00993867244, 38.5], [7.55160533911, 45.0], [8.09006687757, 52.0], [8.62578116328, 59.5], [9.15911449661, 67.5], [9.69036449661, 76.0], [10.2197762613, 85.0], [10.7475540391, 94.5], [11.2738698286, 104.5], [11.7988698286, 115.0]]
    time1 = [item[0] for item in data1]
    resource1 = [item[1] for item in data1]
    time2 = [item[0] for item in data2]
    resource2 = [item[1] for item in data2]
    
    # plot in pylab (total resources over time)
    pylab.plot(time1, resource1, 'o')
    pylab.plot(time2, resource2, 'o')
    pylab.title('Silly Homework')
    pylab.legend(('Data Set no.1', 'Data Set no.2'))
    pylab.xlabel('Current Time')
    pylab.ylabel('Total Resources Generated')
    pylab.show()

#plot_it() 
开发者ID:chubbypanda,项目名称:principles-of-computing,代码行数:24,代码来源:homework1.py

示例7: plot_question2

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_question2():
    '''
    graph of total resources generated as a function of time,
    for four various upgrade_cost_increment values
    '''
    for upgrade_cost_increment in [0.0, 0.5, 1.0, 2.0]:
        data = resources_vs_time(upgrade_cost_increment, 5)
        time = [item[0] for item in data]
        resource = [item[1] for item in data]
    
        # plot in pylab (total resources over time for each constant)
        pylab.plot(time, resource, 'o')
        
    pylab.title('Silly Homework')
    pylab.legend(('0.0', '0.5', '1.0', '2.0'))
    pylab.xlabel('Current Time')
    pylab.ylabel('Total Resources Generated')
    pylab.show()

#plot_question2()   


# Question 3 
开发者ID:chubbypanda,项目名称:principles-of-computing,代码行数:25,代码来源:homework1.py

示例8: plot_question3

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_question3():
    '''
    graph of total resources generated as a function of time;
    for upgrade_cost_increment == 0
    '''
    data = resources_vs_time(0.0, 100)
    time = [item[0] for item in data]
    resource = [item[1] for item in data]

    # plot in pylab on logarithmic scale (total resources over time for upgrade growth 0.0)
    pylab.loglog(time, resource)
        
    pylab.title('Silly Homework')
    pylab.legend('0.0')
    pylab.xlabel('Current Time')
    pylab.ylabel('Total Resources Generated')
    pylab.show()

#plot_question3()


# Question 4 
开发者ID:chubbypanda,项目名称:principles-of-computing,代码行数:24,代码来源:homework1.py

示例9: plot_question7

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_question7():
    '''
    graph of total resources generated as a function of time,
    for upgrade_cost_increment == 1
    '''
    data = resources_vs_time(1.0, 50)
    time = [item[0] for item in data]
    resource = [item[1] for item in data]
    a, b, c = pylab.polyfit(time, resource, 2)
    print 'polyfit with argument \'2\' fits the data, thus the degree of the polynomial is 2 (quadratic)'

    # plot in pylab on logarithmic scale (total resources over time for upgrade growth 0.0)
    #pylab.loglog(time, resource, 'o')

    # plot fitting function
    yp = pylab.polyval([a, b, c], time)
    pylab.plot(time, yp)
    pylab.scatter(time, resource)
    pylab.title('Silly Homework, Question 7')
    pylab.legend(('Resources for increment 1', 'Fitting function' + ', slope: ' + str(a)))
    pylab.xlabel('Current Time')
    pylab.ylabel('Total Resources Generated')
    pylab.grid()
    pylab.show() 
开发者ID:chubbypanda,项目名称:principles-of-computing,代码行数:26,代码来源:homework1.py

示例10: pcolor

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def pcolor(self, xname, yname, zname, *args, **kwargs):
        """Plot the results from the experiment.data pandas dataframe in a pcolor graph.
        Store the plots in a plots list attribute."""
        title = self.title
        x, y, z = self._data[xname], self._data[yname], self._data[zname]
        shape = (len(y.unique()), len(x.unique()))
        diff = shape[0] * shape[1] - len(z)
        Z = np.concatenate((z.values, np.zeros(diff))).reshape(shape)
        df = pd.DataFrame(Z, index=y.unique(), columns=x.unique())
        ax = sns.heatmap(df)
        pl.title(title)
        pl.xlabel(xname)
        pl.ylabel(yname)
        ax.invert_yaxis()
        pl.plt.show()
        self.plots.append(
            {'type': 'pcolor', 'x': xname, 'y': yname, 'z': zname, 'args': args, 'kwargs': kwargs,
             'ax': ax})
        if ax.get_figure() not in self.figs:
            self.figs.append(ax.get_figure()) 
开发者ID:ralph-group,项目名称:pymeasure,代码行数:22,代码来源:experiment.py

示例11: plot_Geweke

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot_Geweke(parameterdistribution,parametername):
    '''Input:  Takes a list of sampled values for a parameter and his name as a string
       Output: Plot as seen for e.g. in BUGS or PyMC'''
    import matplotlib.pyplot as plt

    # perform the Geweke test
    Geweke_values = _Geweke(parameterdistribution)

    # plot the results
    fig = plt.figure()
    plt.plot(Geweke_values,label=parametername)
    plt.legend()
    plt.title(parametername + '- Geweke_Test')
    plt.xlabel('Subinterval')
    plt.ylabel('Geweke Test')
    plt.ylim([-3,3])

    # plot the delimiting line
    plt.plot( [2]*len(Geweke_values), 'r-.')
    plt.plot( [-2]*len(Geweke_values), 'r-.') 
开发者ID:thouska,项目名称:spotpy,代码行数:22,代码来源:analyser.py

示例12: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot(self):
        """ Plot the layer data (for debugging)
        :return: The current figure
        """
        import pylab as pl
        aspect = self.nrows / float(self.ncols)
        figure_width = 6 #inches

        rows = max(1, int(np.sqrt(self.nlayers)))
        cols = int(np.ceil(self.nlayers/rows))
        # noinspection PyUnresolvedReferences
        pallette = {i:rgb for (i, rgb) in enumerate(pl.cm.jet(np.linspace(0, 1, 4), bytes=True))}
        f, a = pl.subplots(rows, cols)
        f.set_size_inches(6 * cols, 6 * rows)
        a = a.flatten()
        for i, label in enumerate(self.label_names):
            pl.sca(a[i])
            pl.title(label)
            pl.imshow(self.color_data)
            pl.imshow(colorize(self.label_data[:, :, i], pallette), alpha=0.5)
            # axis('off')
        return f 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:24,代码来源:import_labelme.py

示例13: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
def plot(self, overlay_alpha=0.5):
        import pylab as pl
        rows = int(sqrt(self.layers()))
        cols = int(ceil(self.layers()/rows))

        for i in range(rows*cols):
            pl.subplot(rows, cols, i+1)
            pl.axis('off')
            if i >= self.layers():
                continue
            pl.title('{}({})'.format(self.labels[i], i))
            pl.imshow(self.image)
            pl.imshow(colorize(self.features[i].argmax(0),
                               colors=np.array([[0,     0, 255],
                                                [0,   255, 255],
                                                [255, 255, 0],
                                                [255, 0,   0]])),
                      alpha=overlay_alpha) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:20,代码来源:model.py

示例14: plot_rectified

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
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) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:24,代码来源:rectify.py

示例15: plot_original

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import title [as 别名]
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) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:24,代码来源:rectify.py


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