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


Python pyplot.suptitle方法代码示例

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


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

示例1: plotNNFilter

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def plotNNFilter(units, figure_id, interp='bilinear', colormap=cm.jet, colormap_lim=None, title=''):
    plt.ion()
    filters = units.shape[2]
    n_columns = round(math.sqrt(filters))
    n_rows = math.ceil(filters / n_columns) + 1
    fig = plt.figure(figure_id, figsize=(n_rows*3,n_columns*3))
    fig.clf()

    for i in range(filters):
        ax1 = plt.subplot(n_rows, n_columns, i+1)
        plt.imshow(units[:,:,i].T, interpolation=interp, cmap=colormap)
        plt.axis('on')
        ax1.set_xticklabels([])
        ax1.set_yticklabels([])
        plt.colorbar()
        if colormap_lim:
            plt.clim(colormap_lim[0],colormap_lim[1])

    plt.subplots_adjust(wspace=0, hspace=0)
    plt.tight_layout()
    plt.suptitle(title) 
开发者ID:ozan-oktay,项目名称:Attention-Gated-Networks,代码行数:23,代码来源:visualise_attention.py

示例2: _plot_loss

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def _plot_loss(training_details, validation_details, note, output_graph_path, solver):
    """
    Plots training/validation loss side by side.
    """
    print "\tPlotting training/validation loss..."
    fig, ax1 = plt.subplots()
    ax1.plot(training_details["iters"], training_details["loss"], "b-")
    ax1.set_xlabel("Iterations")
    ax1.set_ylabel("Training Loss", color="b")
    for tl in ax1.get_yticklabels():
        tl.set_color("b")

    ax2 = ax1.twinx()
    ax2.plot(validation_details["iters"], validation_details["loss"], "r-")
    ax2.set_ylabel("Validation Loss", color="r")
    for tl in ax2.get_yticklabels():
        tl.set_color("r")

    plt.suptitle("Iterations vs. Training/Validation Loss", fontsize=14)
    plt.title(_get_hyperparameter_details(note, solver), style="italic", fontsize=12)

    filename = output_graph_path + ".loss.png"
    plt.savefig(filename)
    plt.close()
    print("\t\tGraph saved to %s" % filename) 
开发者ID:BradNeuberg,项目名称:cloudless,代码行数:27,代码来源:test.py

示例3: plot_results

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def plot_results(data, nth_iteration):
    """
    Plots the list it receives and cuts off the first ten entries to circumvent the plotting of initial silence

    :param data: A list of data to be plotted
    :param nth_iteration: Used for the label of the x axis
    """

    # Plot the data
    plt.plot(data[10:])

    # Label the axes
    plt.xlabel('Time (every {}th {} byte)'.format(nth_iteration, CHUNK))
    plt.ylabel('Volume level difference (in dB)')

    # Calculate and output the absolute median difference level
    plt.suptitle('Difference - Median (in dB): {}'.format(np.round(np.fabs(np.median(data)), decimals=5)), fontsize=14)

    # Display the plotted graph
    plt.show() 
开发者ID:loehnertz,项目名称:rattlesnake,代码行数:22,代码来源:rattlesnake.py

示例4: test_axes_labeling

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def test_axes_labeling():
    from numpy.random import rand
    key_set = (['male', 'female'], ['old', 'adult', 'young'],
               ['worker', 'unemployed'], ['yes', 'no'])
    # the cartesian product of all the categories is
    # the complete set of categories
    keys = list(product(*key_set))
    data = OrderedDict(zip(keys, rand(len(keys))))
    lab = lambda k: ''.join(s[0] for s in k)
    fig, (ax1, ax2) = pylab.subplots(1, 2, figsize=(16, 8))
    mosaic(data, ax=ax1, labelizer=lab, horizontal=True, label_rotation=45)
    mosaic(data, ax=ax2, labelizer=lab, horizontal=False,
        label_rotation=[0, 45, 90, 0])
    #fig.tight_layout()
    fig.suptitle("correct alignment of the axes labels")
    #pylab.show()
    pylab.close('all') 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:19,代码来源:test_mosaicplot.py

示例5: queue

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def queue(self,filename):
        plt.figure()
        df = pd.read_csv('queue.csv')
        size = df[df.Event == 'size'].copy()
        ax1 = size.plot(x='Time',y='Queue Size')
        # drop
        try:
            drop = df[df.Event == 'drop'].copy()
            drop['Queue Size']  =  df['Queue Size'] + 1
            ax = drop.plot(x='Time',y='Queue Size',kind='scatter',marker='x',s=10,ax=ax1)
        except:
            pass
        # set the axes
        ax.set_xlabel('Time')
        ax.set_ylabel('Queue Size (packets)')
        plt.suptitle("")
        plt.title("")
        plt.savefig(filename) 
开发者ID:zappala,项目名称:bene,代码行数:20,代码来源:tcp-plot.py

示例6: sequence

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def sequence(self,filename):
        plt.figure()
        df = pd.read_csv('sequence.csv',dtype={'Time':float,'Sequence Number':int})
        df['Sequence Number']  =  df['Sequence Number'] / 1000 % 50
        # send
        send = df[df.Event == 'send'].copy()
        ax1 = send.plot(x='Time',y='Sequence Number',kind='scatter',marker='s',s=2,figsize=(11,3))
        # transmit
        transmit = df[df.Event == 'transmit'].copy()
        transmit.plot(x='Time',y='Sequence Number',kind='scatter',marker='s',s=2,figsize=(11,3),ax=ax1)
        # drop
        try:
            drop = df[df.Event == 'drop'].copy()
            drop.plot(x='Time',y='Sequence Number',kind='scatter',marker='x',s=10,figsize=(11,3),ax=ax1)
        except:
            pass
        # ack
        ack = df[df.Event == 'ack'].copy()
        ax = ack.plot(x='Time',y='Sequence Number',kind='scatter',marker='.',s=2,figsize=(11,3),ax=ax1)
        ax.set_xlim(left=-0.01)
        ax.set_xlabel('Time')
        ax.set_ylabel('Sequence Number')
        plt.suptitle("")
        plt.title("")
        plt.savefig(filename,dpi=300) 
开发者ID:zappala,项目名称:bene,代码行数:27,代码来源:tcp-plot.py

示例7: main

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def main(self):
        X_train, X_test = self.standard_scale(mnist.train.images, mnist.test.images)

        original_imgs = X_test[:100]
        plt.figure(1, figsize=(10, 10))

        for i in range(0, 100):
            im = original_imgs[i].reshape((28, 28))
            ax = plt.subplot(10, 10, i + 1)
            for label in (ax.get_xticklabels() + ax.get_yticklabels()):
                label.set_fontsize(8)

            plt.imshow(im, cmap="gray", clim=(0.0, 1.0))
        plt.suptitle(' Original Images', fontsize=15, y=0.95)
        plt.savefig('figures/original_images.png')
        plt.show() 
开发者ID:PacktPublishing,项目名称:Neural-Network-Programming-with-TensorFlow,代码行数:18,代码来源:original_images_example.py

示例8: phase_shift_figure

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def phase_shift_figure(I,PR,type):
	"""
	Draw PSI Interferograms, several types.
	"""
	if type == "4-step":
		f, axarr = __plt__.subplots(2, 2, figsize=(9, 9), dpi=80)
		axarr[0, 0].imshow(-I[0], extent=[-PR,PR,-PR,PR],cmap=__cm__.Greys)
		axarr[0, 0].set_title(r'$Phase\ shift: 0$',fontsize=16)
		axarr[0, 1].imshow(-I[1], extent=[-PR,PR,-PR,PR],cmap=__cm__.Greys)
		axarr[0, 1].set_title(r'$Phase\ shift: 1/2\pi$',fontsize=16)
		axarr[1, 0].imshow(-I[2], extent=[-PR,PR,-PR,PR],cmap=__cm__.Greys)
		axarr[1, 0].set_title(r'$Phase\ shift: \pi$',fontsize=16)
		axarr[1, 1].imshow(-I[3], extent=[-PR,PR,-PR,PR],cmap=__cm__.Greys)
		axarr[1, 1].set_title(r'$Phase\ shift: 3/2\pi$',fontsize=16)
		__plt__.suptitle('4-step Phase Shift Interferograms',fontsize=16)
		__plt__.show()
	else:
		print("No this type of figure") 
开发者ID:Sterncat,项目名称:opticspy,代码行数:20,代码来源:tools.py

示例9: plot_aep_boxplot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def plot_aep_boxplot(self, param, lab):
        """                                                                                                                                                                                        
        Plot box plots of AEP results sliced by a specified Monte Carlo parameter                                                                                                                  

        Args:                                                                                                                                                                                      
           param( :obj:`list'): The Monte Carlo parameter on which to split the AEP results
           lab(:obj:'str'): The name to use for the parameter when producing the figure
        
        Returns:                                                                                                                                                                                   
            (none)                                                                                                                                                                               
        """

        import matplotlib.pyplot as plt
        sim_results = self.results

        tmp_df=pd.DataFrame(data={'aep': sim_results.aep_GWh, 'param': param})
        tmp_df.boxplot(column='aep',by='param',figsize=(8,6))
        plt.ylabel('AEP (GWh/yr)')
        plt.xlabel(lab)
        plt.title('AEP estimates by %s' % lab)
        plt.suptitle("")
        plt.tight_layout()
        return plt 
开发者ID:NREL,项目名称:OpenOA,代码行数:25,代码来源:plant_analysis.py

示例10: show_shrinkage

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def show_shrinkage(shrink_func,theta,**kwargs):
    tf.reset_default_graph()
    tf.set_random_seed(kwargs.get('seed',1) )

    N = kwargs.get('N',500)
    L = kwargs.get('L',4)
    nsigmas = kwargs.get('sigmas',10)
    shape = (N,L)
    rvar = 1e-4
    r = np.reshape( np.linspace(0,nsigmas,N*L)*math.sqrt(rvar),shape)
    r_ = tfcf(r)
    rvar_ = tfcf(np.ones(L)*rvar)

    xhat_,dxdr_ = shrink_func(r_,rvar_ ,tfcf(theta))

    with tf.Session() as sess:
        sess.run( tf.global_variables_initializer() )
        xhat = sess.run(xhat_)
    import matplotlib.pyplot as plt
    plt.figure(1)
    plt.plot(r.reshape(-1),r.reshape(-1),'y')
    plt.plot(r.reshape(-1),xhat.reshape(-1),'b')
    if kwargs.has_key('title'):
        plt.suptitle(kwargs['title'])
    plt.show() 
开发者ID:mborgerding,项目名称:onsager_deep_learning,代码行数:27,代码来源:shrinkage.py

示例11: plot

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def plot(posterior_file, outputfile):
    inside, membrane, outside = load_posterior_file(posterior_file)

    plt.figure(figsize=(16, 8))
    plt.title('Posterior probabilities')
    plt.suptitle('tmhmm.py')
    plt.plot(inside, label='inside', color='blue')
    plt.plot(membrane, label='transmembrane', color='red')
    plt.fill_between(range(len(inside)), membrane, color='red')
    plt.plot(outside, label='outside', color='black')
    plt.legend(frameon=False, bbox_to_anchor=[0.5, 0],
               loc='upper center', ncol=3, borderaxespad=1.5)
    plt.tight_layout(pad=3)
    plt.savefig(outputfile) 
开发者ID:dansondergaard,项目名称:tmhmm.py,代码行数:16,代码来源:cli.py

示例12: draw_pz

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def draw_pz(self, tfcn):
        """Draw pzmap"""
        self.f_pzmap.clf()
        # Make adaptive window size, with min [-10, 10] in range,
        # always atleast 25% extra space outside poles/zeros
        tmp = list(self.zeros)+list(self.poles)+[8]
        val = 1.25*max(abs(array(tmp)))
        plt.figure(self.f_pzmap.number)
        control.matlab.pzmap(tfcn)
        plt.suptitle('Pole-Zero Diagram')

        plt.axis([-val, val, -val, val]) 
开发者ID:python-control,项目名称:python-control,代码行数:14,代码来源:tfvis.py

示例13: redraw

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def redraw(self):
        """ Redraw all diagrams """
        self.draw_pz(self.sys)
        
        self.f_bode.clf()
        plt.figure(self.f_bode.number)
        control.matlab.bode(self.sys, logspace(-2, 2))
        plt.suptitle('Bode Diagram')

        self.f_nyquist.clf()
        plt.figure(self.f_nyquist.number)
        control.matlab.nyquist(self.sys, logspace(-2, 2))
        plt.suptitle('Nyquist Diagram')

        self.f_step.clf()
        plt.figure(self.f_step.number)
        try:
            # Step seems to get intro trouble
            # with purely imaginary poles
            tvec, yvec = control.matlab.step(self.sys)
            plt.plot(tvec.T, yvec)
        except:
            print("Error plotting step response")
        plt.suptitle('Step Response')

        self.canvas_pzmap.draw()
        self.canvas_bode.draw()
        self.canvas_step.draw()
        self.canvas_nyquist.draw() 
开发者ID:python-control,项目名称:python-control,代码行数:31,代码来源:tfvis.py

示例14: plot_draw

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def plot_draw(self, x_axis: list, y_axis: list, latest_result):
        y_axis_parsed = []
        for y in y_axis:
            try:
                y_axis_parsed.append(y['best'])
            except:
                break
        if y_axis_parsed:
            y_axis = y_axis_parsed

        plt.figure(1)
        # self.subplot.set_xlim([self.plot_x_axis[0], self.plot_x_axis[-1]])
        self.subplot.set_ylim([min(y_axis) - 5, max(y_axis) + 5])
        plt.suptitle('Best solution so far: ' + re.sub("(.{64})", "\\1\n", str(latest_result), 0, re.DOTALL),
                     fontsize=10)
        print(latest_result)
        self.subplot.plot(x_axis, y_axis)

        plt.figure(2)
        for route_x, route_y in latest_result.plot_get_route_cords():
            plt.plot(route_x, route_y)

        plt.draw()
        self.fig.savefig("plot-output.png")
        self.fig_node_connector.savefig("plot2-output.png")
        plt.pause(0.000001) 
开发者ID:shayan-ys,项目名称:VRPTW-ga,代码行数:28,代码来源:report.py

示例15: main

# 需要导入模块: from matplotlib import pyplot [as 别名]
# 或者: from matplotlib.pyplot import suptitle [as 别名]
def main():
    vae = VAE(Z=32)

    data = inmemory.MNIST()
    steps_per_epoch = data.steps_per_epoch(32, "train")
    loss_history = {"recon": [], "kld": []}
    for epoch in range(1, 31):
        print("\n\nEpoch", epoch)
        for i, (x, y) in enumerate(data.stream(batch_size=32, subset="train")):
            recon, kld = vae.train_on_batch(x)
            loss_history["recon"].append(recon)
            loss_history["kld"].append(kld)
            print("\rDone: {:.2%} Reconstruction loss: {:.4f} KL-divergence: {:.4f}"
                  .format(i / steps_per_epoch,
                          np.mean(loss_history["recon"][-100:]),
                          np.mean(loss_history["kld"][-100:])), end="")
            if i == steps_per_epoch:
                break
        if epoch == 20:
            for optimizer in vae.optimizers:
                print("DROPPED!!!")
                optimizer.eta *= 0.1

    for x, y in data.stream(subset="val", batch_size=1):
        r, mse, kld = vae.reconstruct(x, return_loss=True)
        r = r.reshape(x.shape)[0]

        r, x = data.deprocess(r).squeeze(), data.deprocess(x[0]).squeeze()

        fig, (left, right) = plt.subplots(1, 2, sharex="all", sharey="all", figsize=(16, 9))
        left.imshow(x)
        right.imshow(r)
        left.set_title("original")
        right.set_title("reconstruction")
        plt.suptitle("MSE: {:.4f} KLD: {:.4f}".format(mse, kld))
        plt.tight_layout()
        plt.show() 
开发者ID:csxeba,项目名称:brainforge,代码行数:39,代码来源:xp_vae.py


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