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


Python pylab.show方法代码示例

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


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

示例1: vPlotEquityCurves

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def vPlotEquityCurves(oBt, mOhlc, oChefModule,
                      sPeriod='W',
                      close_label='C',):
    import matplotlib
    import matplotlib.pylab as pylab
    # FixMe:
    matplotlib.rcParams['figure.figsize'] = (10, 5)

    # FixMe: derive the period from the sTimeFrame
    oChefModule.vPlotEquity(oBt.equity, mOhlc, sTitle="%s\nEquity" % repr(oBt),
                            sPeriod=sPeriod,
                            close_label=close_label,
                            )
    pylab.show()

    oBt.vPlotTrades()
    pylab.legend(loc='lower left')
    pylab.show()

    ## oBt.vPlotTrades(subset=slice(sYear+'-05-01', sYear+'-09-01'))
    ## pylab.legend(loc='lower left')
    ## pylab.show() 
开发者ID:OpenTrading,项目名称:OpenTrader,代码行数:24,代码来源:OTBackTest.py

示例2: test_plotting

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def test_plotting(self):
        """
        This test is just to document current use in libraries in case of refactoring
        """
        corrs = np.array([.6, .2, .1, .001])
        errs = np.array([.1, .05, .04, .0005])
        fig, ax1 = plt.subplots(1, 1, figsize=(5, 5))
        cca.plot_correlations(corrs, errs, ax=ax1, color='blue')
        cca.plot_correlations(corrs * .1, errs, ax=ax1, color='orange')

    # Shuffle data
    # ...
    # fig, ax1 = plt.subplots(1,1,figsize(10,10))
    # plot_correlations(corrs, ... , ax=ax1, color='blue')
    # plot_correlations(shuffled_coors, ..., ax=ax1, color='red')
    # plt.show() 
开发者ID:int-brain-lab,项目名称:ibllib,代码行数:18,代码来源:test_cca.py

示例3: plot

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot(self, words, num_points=None):
        if not num_points:
            num_points = len(words)

        embeddings = self.get_words_embeddings(words)
        tsne = TSNE(perplexity=30, n_components=2, init='pca', n_iter=5000)
        two_d_embeddings = tsne.fit_transform(embeddings[:num_points, :])

        assert two_d_embeddings.shape[0] >= len(words), 'More labels than embeddings'
        pylab.figure(figsize=(15, 15))  # in inches
        for i, label in enumerate(words[:num_points]):
            x, y = two_d_embeddings[i, :]
            pylab.scatter(x, y)
            pylab.annotate(label, xy=(x, y), xytext=(5, 2), textcoords='offset points',
                           ha='right', va='bottom')
        pylab.show() 
开发者ID:mouradmourafiq,项目名称:philo2vec,代码行数:18,代码来源:models.py

示例4: plot_confusion_matrix

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_confusion_matrix(cm, genre_list, name, title):
    pylab.clf()
    pylab.matshow(cm, fignum=False, cmap='Blues', vmin=0, vmax=1.0)
    ax = pylab.axes()
    ax.set_xticks(range(len(genre_list)))
    ax.set_xticklabels(genre_list)
    ax.xaxis.set_ticks_position("bottom")
    ax.set_yticks(range(len(genre_list)))
    ax.set_yticklabels(genre_list)
    pylab.title(title)
    pylab.colorbar()
    pylab.grid(False)
    pylab.show()
    pylab.xlabel('Predicted class')
    pylab.ylabel('True class')
    pylab.grid(False)
    pylab.savefig(
        os.path.join(CHART_DIR, "confusion_matrix_%s.png" % name), bbox_inches="tight") 
开发者ID:PacktPublishing,项目名称:Building-Machine-Learning-Systems-With-Python-Second-Edition,代码行数:20,代码来源:utils.py

示例5: plot_equilibration

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_equilibration(temperature_next, strain_lst, nve_run_time_steps, project_parameter, debug_plot=True):
    if debug_plot:
        for strain in strain_lst:
            job_name = get_nve_job_name(
                temperature_next=temperature_next,
                strain=strain,
                steps_lst=project_parameter['nve_run_time_steps_lst'],
                nve_run_time_steps=nve_run_time_steps
            )
            ham_nve = project_parameter['project'].load(job_name)
            plt.plot(ham_nve['output/generic/temperature'], label='strain: ' + str(strain))
            plt.axhline(np.mean(ham_nve['output/generic/temperature'][-20:]), linestyle='--', color='red')
            plt.axvline(range(len(ham_nve['output/generic/temperature']))[-20], linestyle='--', color='black')
            plt.legend()
            plt.xlabel('timestep')
            plt.ylabel('Temperature K')
            plt.legend()
            plt.show() 
开发者ID:pyiron,项目名称:pyiron,代码行数:20,代码来源:interfacemethod.py

示例6: check_for_holes

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def check_for_holes(temperature_next, strain_value_lst, nve_run_time_steps, project_parameter, debug_plot=True):
    max_lst, mean_lst = get_voronoi_volume(
        temperature_next=temperature_next,
        strain_lst=strain_value_lst,
        nve_run_time_steps=nve_run_time_steps,
        project_parameter=project_parameter
    )
    if debug_plot:
        plt.plot(strain_value_lst, mean_lst, label='mean')
        plt.plot(strain_value_lst, max_lst, label='max')
        plt.axhline(np.mean(mean_lst) * 2, color='black', linestyle='--')
        plt.legend()
        plt.xlabel('Strain')
        plt.ylabel('Voronoi Volume')
        plt.show()
    return np.array(max_lst) < np.mean(mean_lst) * 2 
开发者ID:pyiron,项目名称:pyiron,代码行数:18,代码来源:interfacemethod.py

示例7: __init__

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def __init__(self, name = "unknown", data = -1, is_show = False):
        self.name   = name
        self.data   = data
        self.size   = np.shape(self.data)
        self.is_show = is_show
        self.color_space = "unknown"
        self.bayer_pattern = "unknown"
        self.channel_gain = (1.0, 1.0, 1.0, 1.0)
        self.bit_depth = 0
        self.black_level = (0, 0, 0, 0)
        self.white_level = (1, 1, 1, 1)
        self.color_matrix = [[1., .0, .0],\
                             [.0, 1., .0],\
                             [.0, .0, 1.]] # xyz2cam
        self.min_value = np.min(self.data)
        self.max_value = np.max(self.data)
        self.data_type = self.data.dtype

        # Display image only isShow = True
        if (self.is_show):
            plt.imshow(self.data)
            plt.show() 
开发者ID:mushfiqulalam,项目名称:isp,代码行数:24,代码来源:imaging.py

示例8: plot

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot(self):
        try:
            import pandas as pd
            import matplotlib.pylab as plt
            df = pd.DataFrame(self.history).set_index(['id', 'generation']).fillna(0)
            population_size = sum(df.iloc[0].values)
            n_populations = df.reset_index()['id'].nunique()
            fig, axes = plt.subplots(nrows=n_populations, figsize=(12, 2*n_populations),
                                     sharex='all', sharey='all', squeeze=False)
            for row, (_, pop) in zip(axes, df.groupby('id')):
                ax = row[0]
                pop.reset_index(level='id', drop=True).plot(ax=ax)
                ax.set_ylim([0, population_size])
                ax.set_xlabel('iteration')
                ax.set_ylabel('# w/ preference')
                if n_populations > 1:
                    for i in range(0, df.reset_index().generation.max(), 50):
                        ax.axvline(i)
            plt.show()
        except ImportError:
            print("If you install matplotlib and pandas you will get a pretty plot.") 
开发者ID:godatadriven,项目名称:evol,代码行数:23,代码来源:rock_paper_scissors.py

示例9: plot_pr_curve

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_pr_curve(pr_curve_dml, pr_curve_base, title):
    """
      Function that plots the PR-curve.

      Args:
        pr_curve: the values of precision for each recall value
        title: the title of the plot
    """
    plt.figure(figsize=(16, 9))
    plt.plot(np.arange(0.0, 1.05, 0.05),
             pr_curve_base, color='r', marker='o', linewidth=3, markersize=10)
    plt.plot(np.arange(0.0, 1.05, 0.05),
             pr_curve_dml, color='b', marker='o', linewidth=3, markersize=10)
    plt.grid(True, linestyle='dotted')
    plt.xlabel('Recall', color='k', fontsize=27)
    plt.ylabel('Precision', color='k', fontsize=27)
    plt.yticks(color='k', fontsize=20)
    plt.xticks(color='k', fontsize=20)
    plt.ylim([0.0, 1.05])
    plt.xlim([0.0, 1.0])
    plt.title(title, color='k', fontsize=27)
    plt.tight_layout()
    plt.show() 
开发者ID:MKLab-ITI,项目名称:ndvr-dml,代码行数:25,代码来源:utils.py

示例10: plot_trajectory

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_trajectory(name):
    STEPS = 600
    DELTA = 1 if name != 'linear' else 0.1
    trajectory = create_trajectory(name, STEPS)

    x = [trajectory.get_position_at(i * DELTA).x for i in range(STEPS)]
    y = [trajectory.get_position_at(i * DELTA).y for i in range(STEPS)]

    trajectory_fig, trajectory_plot = plt.subplots(1, 1)
    trajectory_plot.plot(x, y, label='trajectory', lw=3)
    trajectory_plot.set_title(name.title() + ' Trajectory', fontsize=20)
    trajectory_plot.set_xlabel(r'$x{\rm[m]}$', fontsize=18)
    trajectory_plot.set_ylabel(r'$y{\rm[m]}$', fontsize=18)
    trajectory_plot.legend(loc=0)
    trajectory_plot.grid()
    plt.show() 
开发者ID:lmiguelvargasf,项目名称:trajectory_tracking,代码行数:18,代码来源:menu.py

示例11: plotKChart

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plotKChart(self, misClassDict, saveFigPath):
        kList = []
        misRateList = []
        for k, misClassNum in misClassDict.iteritems():
            kList.append(k)
            misRateList.append(1.0 - 1.0/k*misClassNum)

        fig = plt.figure(saveFigPath)
        plt.plot(kList, misRateList, 'r--')
        plt.title(saveFigPath)
        plt.xlabel('k Num.')
        plt.ylabel('Misclassified Rate')
        plt.legend(saveFigPath)
        plt.grid(True)
        plt.savefig(saveFigPath)
        plt.show()

################################### PART3 TEST ########################################
# 例子 
开发者ID:ysh329,项目名称:statistical-learning-methods-note,代码行数:21,代码来源:kNN.py

示例12: plot_xz_landscape

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_xz_landscape(self):
        """
        plots the xz landscape, i.e., how your vna frequency span changes with respect to the x vector
        :return: None
        """
        if not qkit.module_available("matplotlib"):
            raise ImportError("matplotlib not found.")

        if self.xzlandscape_func:
            y_values = self.xzlandscape_func(self.spec.x_vec)
            plt.plot(self.spec.x_vec, y_values, 'C1')
            plt.fill_between(self.spec.x_vec, y_values+self.z_span/2., y_values-self.z_span/2., color='C0', alpha=0.5)
            plt.xlim((self.spec.x_vec[0], self.spec.x_vec[-1]))
            plt.ylim((self.xz_freqpoints[0], self.xz_freqpoints[-1]))
            plt.show()
        else:
            print('No xz funcion generated. Use landscape.generate_xz_function') 
开发者ID:qkitgroup,项目名称:qkit,代码行数:19,代码来源:spectroscopy.py

示例13: plot_fit_function

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def plot_fit_function(self, num_points=100):
        '''
        try:
            x_coords = np.linspace(self.x_vec[0], self.x_vec[-1], num_points)
        except Exception as message:
            print 'no x axis information specified', message
            return
        '''
        if not qkit.module_available("matplotlib"):
            raise ImportError("matplotlib not found.")
        if self.landscape:
            for trace in self.landscape:
                try:
                    # plt.clear()
                    plt.plot(self.x_vec, trace)
                    plt.fill_between(self.x_vec, trace + float(self.span) / 2, trace - float(self.span) / 2, alpha=0.5)
                except Exception:
                    print('invalid trace...skip')
            plt.axhspan(self.y_vec[0], self.y_vec[-1], facecolor='0.5', alpha=0.5)
            plt.show()
        else:
            print('No trace generated.') 
开发者ID:qkitgroup,项目名称:qkit,代码行数:24,代码来源:signal_spectroscopy.py

示例14: show_pred

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def show_pred(images, predictions, ground_truth):
    # choose 10 indice from images and visualize them
    indice = [np.random.randint(0, len(images)) for i in range(40)]
    for i in range(0, 40):
        plt.figure()
        plt.subplot(1, 3, 1)
        plt.tight_layout()
        plt.title('deformed image')
        plt.imshow(images[indice[i]])
        plt.subplot(1, 3, 2)
        plt.tight_layout()
        plt.title('predicted mask')
        plt.imshow(predictions[indice[i]])
        plt.subplot(1, 3, 3)
        plt.tight_layout()
        plt.title('ground truth label')
        plt.imshow(ground_truth[indice[i]])
    plt.show()

# Load Data Science Bowl 2018 training dataset 
开发者ID:limingwu8,项目名称:Image-Restoration,代码行数:22,代码来源:dataset.py

示例15: train

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import show [as 别名]
def train(self):
        """
        训练
        """
        training_set,test_set, training_inputs, training_target, test_inputs, test_targets = self.getData()

        eth_model = self.buildModel(training_inputs, 1, 20)
        training_target = (training_set["eth_Close"][self.window_len:].values /
                           training_set['eth_Close'][:-self.window_len].values) - 1

        eth_history = eth_model.fit(training_inputs, training_target,
                                    epochs=self.epochs, batch_size=self.batch_size,
                                    verbose=self.verbose, shuffle=True)

        fig, ax1 = plt.subplots(1, 1)
        ax1.plot(eth_history.epoch, eth_history.history['loss'])
        ax1.set_title('Training Loss')
        ax1.set_ylabel('MAE',fontsize=12)
        ax1.set_xlabel('# Epochs',fontsize=12)
        plt.show() 
开发者ID:jarvisqi,项目名称:deep_learning,代码行数:22,代码来源:bitcoin_price.py


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