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


Python pylab.subplots方法代码示例

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


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

示例1: __init__

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def __init__(self, project):
        self._ref_path = project.path
        self.project = project.copy()
        self.project._inspect_mode = True
        self.parent = None
        self.name = None
        self.fig, self.ax = None, None
        self.w_group = None
        self.w_node = None
        self.w_file = None
        self.w_text = None
        self.w_tab = None
        self.w_path = None
        self.w_type = None
        #         self.fig, self.ax = plt.subplots()

        self.create_widgets()
        self.connect_widgets()
        self.display() 
开发者ID:pyiron,项目名称:pyiron,代码行数:21,代码来源:gui.py

示例2: plot_dos

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_dos(self, ax=None, *args, **qwargs):
        """

        Args:
            *args:
            ax:
            **qwargs:

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        if ax is None:
            fig, ax = plt.subplots(1, 1)
        ax.plot(self["output/dos_energies"], self["output/dos_total"], *args, **qwargs)
        ax.set_xlabel("Frequency [THz]")
        ax.set_ylabel("DOS")
        ax.set_title("Phonon DOS vs Energy")
        return ax 
开发者ID:pyiron,项目名称:pyiron,代码行数:24,代码来源:phonopy.py

示例3: plot_contourf

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_contourf(self, ax=None, show_min_erg_path=False):
        """

        Args:
            ax:
            show_min_erg_path:

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        x, y = self.meshgrid()
        if ax is None:
            fig, ax = plt.subplots(1, 1)
        ax.contourf(x, y, self.energies)
        if show_min_erg_path:
            plt.plot(self.get_minimum_energy_path(), self.temperatures, "w--")
        plt.xlabel("Volume [$\AA^3$]")
        plt.ylabel("Temperature [K]")
        return ax 
开发者ID:pyiron,项目名称:pyiron,代码行数:25,代码来源:thermo_bulk.py

示例4: plot_min_energy_path

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_min_energy_path(self, *args, ax=None, **qwargs):
        """

        Args:
            *args:
            ax:
            **qwargs:

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt
        if ax is None:
            fig, ax = plt.subplots(1, 1)
            ax.xlabel("Volume [$\AA^3$]")
            ax.ylabel("Temperature [K]")
        ax.plot(self.get_minimum_energy_path(), self.temperatures, *args, **qwargs)
        return ax 
开发者ID:pyiron,项目名称:pyiron,代码行数:23,代码来源:thermo_bulk.py

示例5: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [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

示例6: plot_fractions

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_fractions(df, label=None):
    """Process results of multiple mappings to get fractions
    of each annotations mapped
    label: plot this sample only"""

    fig,ax = plt.subplots(figsize=(8,8))
    df = df.set_index('label')
    df = df._get_numeric_data()
    if len(df) == 1:
        label = df.index[0]
    if label != None:
        ax = df.T.plot(y=label,kind='pie',colormap='Spectral',autopct='%.1f%%',
                      startangle=0, labels=None,legend=True,pctdistance=1.1,
                      fontsize=10, ax=ax)
    else:
        ax = df.plot(kind='barh',stacked=True,linewidth=0,cmap='Spectral',ax=ax)
        #ax.legend(ncol=2)
        ax.set_position([0.2,0.1,0.6,0.8])
        ax.legend(loc="best",bbox_to_anchor=(1.0, .9))
    plt.title('fractions mapped')
    #plt.tight_layout()
    return fig 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:24,代码来源:plotting.py

示例7: plot_read_count_dists

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_read_count_dists(counts, h=8, n=50):
    """Boxplots of read count distributions """

    scols,ncols = base.get_column_names(counts)
    df = counts.sort_values(by='mean_norm',ascending=False)[:n]
    df = df.set_index('name')[ncols]
    t = df.T
    w = int(h*(len(df)/60.0))+4
    fig, ax = plt.subplots(figsize=(w,h))
    if len(scols) > 1:
        sns.stripplot(data=t,linewidth=1.0,palette='coolwarm_r')
        ax.xaxis.grid(True)
    else:
        df.plot(kind='bar',ax=ax)
    sns.despine(offset=10,trim=True)
    ax.set_yscale('log')
    plt.setp(ax.xaxis.get_majorticklabels(), rotation=90)
    plt.ylabel('read count')
    #print (df.index)
    #plt.tight_layout()
    fig.subplots_adjust(bottom=0.2,top=0.9)
    return fig 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:24,代码来源:plotting.py

示例8: plot_pca

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_pca(pX, palette='Spectral', labels=None, ax=None, colors=None):
    """Plot PCA result, input should be a dataframe"""

    if ax==None:
        fig,ax=plt.subplots(1,1,figsize=(6,6))
    cats = pX.index.unique()
    colors = sns.mpl_palette(palette, len(cats)+1)
    print (len(cats), len(colors))
    for c, i in zip(colors, cats):
        #print (i, len(pX.ix[i]))
        #if not i in pX.index: continue
        ax.scatter(pX.ix[i, 0], pX.ix[i, 1], color=c, s=90, label=i,
                   lw=.8, edgecolor='black', alpha=0.8)
    ax.set_xlabel('PC1')
    ax.set_ylabel('PC2')
    i=0
    if labels is not None:
        for n, point in pX.iterrows():
            l=labels[i]
            ax.text(point[0]+.1, point[1]+.1, str(l),fontsize=(9))
            i+=1
    ax.legend(fontsize=10,bbox_to_anchor=(1.5, 1.05))
    sns.despine()
    plt.tight_layout()
    return 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:27,代码来源:analysis.py

示例9: contour_mult_mo

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def contour_mult_mo(self,x,y,mo,xlabel='x',ylabel='y',title='',r0=0):
    '''Uses matplotlib to show slices of a molecular orbitals.'''
    import matplotlib.pyplot as plt
    
    # Plot slices
    f, pics = \
                plt.subplots(len(mo),1,sharex=True,sharey=True,figsize=(6,2+4*len(mo)))
    plt.suptitle(title)
    vmax = numpy.max(numpy.abs(mo))
    for i,pic in enumerate(pics):
      pic.contour(y,x,mo[i],50,linewidths=0.5,colors='k')
      pic.contourf(\
          y,x,mo[i],50,cmap=plt.cm.rainbow,vmax=vmax,vmin=-vmax)
      pic.set_ylabel(xlabel)  
      pic.set_xlabel(ylabel)  
      pic.set_title('Data Point %d' % (r0+i))
    
    f.subplots_adjust(left=0.15,bottom=0.05,top=0.95,right=0.95)
    f.show()
    return f,pics 
开发者ID:orbkit,项目名称:orbkit,代码行数:22,代码来源:multiple_files.py

示例10: plot_dense_stats

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_dense_stats(self):
        """
        Plot dense layers weight statistics

        :return: A plot
        :History: 2018-May-12 - Written - Henry Leung (University of Toronto)
        """
        self.has_model_check()
        dense_list = []
        for counter, layer in enumerate(self.keras_model.layers):
            if isinstance(layer, tfk.layers.Dense):
                dense_list.append(counter)

        denses = np.array(self.keras_model.layers)[dense_list]
        fig, ax = plt.subplots(1, figsize=(15, 10), dpi=100)
        for counter, dense in enumerate(denses):
            weight_temp = np.array(dense.get_weights())[0].flatten()
            ax.hist(weight_temp, 200, density=True, range=(-2., 2.), alpha=0.7,
                    label=f'Dense Layer {counter}, max: {weight_temp.max():.{2}f}, min: {weight_temp.min():.{2}f}, '
                          f'mean: {weight_temp.mean():.{2}f}, std: {weight_temp.std():.{2}f}')
        fig.suptitle(f'Dense Layers Weight Statistics of {self.folder_name}', fontsize=17)
        ax.set_xlabel('Weights', fontsize=17)
        ax.set_ylabel('Normalized Distribution', fontsize=17)
        ax.minorticks_on()
        ax.tick_params(labelsize=15, width=3, length=10, which='major')
        ax.tick_params(width=1.5, length=5, which='minor')
        ax.legend(loc='best', fontsize=15)
        fig.tight_layout(rect=[0, 0.00, 1, 0.96])
        fig.show()

        return fig 
开发者ID:henrysky,项目名称:astroNN,代码行数:33,代码来源:base_master_nn.py

示例11: plot_array

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_array(self, val):
        """

        Args:
            val:

        Returns:

        """
        try:
            import pylab as plt
        except ImportError:
            import matplotlib.pyplot as plt

        plt.ioff()
        if self.fig is None:
            self.fig, self.ax = plt.subplots()
        else:
            self.ax.clear()

        # self.ax.set_title(self.name)
        if val.ndim == 1:
            self.ax.plot(val)
        elif val.ndim == 2:
            if len(val) == 1:
                self.ax.plot(val[0])
            else:
                self.ax.plot(val)
        elif val.ndim == 3:
            self.ax.plot(val[:, :, 0])
        # self.fig.canvas.draw()
        self.w_text.value = self.plot_to_html()
        plt.close() 
开发者ID:pyiron,项目名称:pyiron,代码行数:35,代码来源:gui.py

示例12: plot_read_lengths

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_read_lengths(filename, df=None):
    """View read length distributions"""

    df = utils.fastq_to_dataframe(filename, size=5e5)
    x = analysis.read_length_dist(df)
    fig,ax=plt.subplots(1,1,figsize=(10,4))
    ax.bar(x[1][:-1],x[0], align='center')
    return fig 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:10,代码来源:plotting.py

示例13: plot_sample_variation

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_sample_variation(df):

    fig,axs=plt.subplots(2,1,figsize=(6,6))
    axs=axs.flat
    cols,ncols = mirdeep2.get_column_names(m)
    x = m.ix[2][cols]
    x.plot(kind='bar',ax=axs[0])
    x2 = m.ix[2][ncols]
    x2.plot(kind='bar',ax=axs[1])
    sns.despine(trim=True,offset=10)
    plt.tight_layout()
    return fig 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:14,代码来源:plotting.py

示例14: plot_by_label

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_by_label(X, palette='Set1'):
    """Color scatter plot by dataframe index label"""

    import seaborn as sns
    cats = X.index.unique()
    colors = sns.mpl_palette(palette, len(cats))
    #sns.palplot(colors)
    f,ax = plt.subplots(figsize=(6,6))
    for c, i in zip(colors, cats):
        #print X.ix[i,0]
        ax.scatter(X.ix[i, 0], X.ix[i, 1], color=c, s=100, label=i,
                   lw=1, edgecolor='black')
    ax.legend(fontsize=10)
    sns.despine()
    return 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:17,代码来源:plotting.py

示例15: plot_results

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import subplots [as 别名]
def plot_results(k):
    fig,ax=plt.subplots(figsize=(8,6))
    ax.set_title('sRNAbench top 10')
    k.set_index('name')['read count'][:10].plot(kind='barh',colormap='Set2',ax=ax,log=True)
    plt.tight_layout()
    fig.savefig('srnabench_summary_known.png')
    return 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:9,代码来源:srnabench.py


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