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


Python pylab.xticks方法代码示例

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


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

示例1: heatmap

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def heatmap(df,fname=None,cmap='seismic',log=False):
    """Plot a heat map"""

    from matplotlib.colors import LogNorm
    f=plt.figure(figsize=(8,8))
    ax=f.add_subplot(111)
    norm=None
    df=df.replace(0,.1)
    if log==True:
        norm=LogNorm(vmin=df.min().min(), vmax=df.max().max())
    hm = ax.pcolor(df,cmap=cmap,norm=norm)
    plt.colorbar(hm,ax=ax,shrink=0.6,norm=norm)
    plt.yticks(np.arange(0.5, len(df.index), 1), df.index)
    plt.xticks(np.arange(0.5, len(df.columns), 1), df.columns, rotation=90)
    #ax.axvline(4, color='gray'); ax.axvline(8, color='gray')
    plt.tight_layout()
    if fname != None:
        f.savefig(fname+'.png')
    return ax 
开发者ID:dmnfarrell,项目名称:smallrnaseq,代码行数:21,代码来源:plotting.py

示例2: plot_confusion_matrix

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_confusion_matrix(test_label, pred):

    mapping = {1:'co2',2:'humidity',3:'pressure',4:'rmt',5:'status',6:'stpt',7:'flow',8:'HW sup',9:'HW ret',10:'CW sup',11:'CW ret',12:'SAT',13:'RAT',17:'MAT',18:'C enter',19:'C leave',21:'occu',30:'pos',31:'power',32:'ctrl',33:'fan spd',34:'timer'}
    cm_ = CM(test_label, pred)
    cm = normalize(cm_.astype(np.float), axis=1, norm='l1')
    fig = pl.figure()
    ax = fig.add_subplot(111)
    cax = ax.matshow(cm, cmap=Color.YlOrBr)
    fig.colorbar(cax)
    for x in range(len(cm)):
        for y in range(len(cm)):
            ax.annotate(str("%.3f(%d)"%(cm[x][y], cm_[x][y])), xy=(y,x),
                        horizontalalignment='center',
                        verticalalignment='center',
                        fontsize=9)
    cm_cls =np.unique(np.hstack((test_label, pred)))
    cls = []
    for c in cm_cls:
        cls.append(mapping[c])
    pl.yticks(range(len(cls)), cls)
    pl.ylabel('True label')
    pl.xticks(range(len(cls)), cls)
    pl.xlabel('Predicted label')
    pl.title('Confusion Matrix (%.3f)'%(ACC(pred, test_label)))
    pl.show() 
开发者ID:plastering,项目名称:plastering,代码行数:27,代码来源:transfer_learning.py

示例3: plot_confusion_matrix

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_confusion_matrix(self, matrix, labels):
        if not self.to_save and not self.to_show:
            return

        pylab.figure()
        pylab.imshow(matrix, interpolation='nearest', cmap=pylab.cm.jet)
        pylab.title("Confusion Matrix")

        for i, vi in enumerate(matrix):
            for j, vj in enumerate(vi):
                pylab.annotate("%.1f" % vj, xy=(j, i), horizontalalignment='center', verticalalignment='center', fontsize=9)

        pylab.colorbar()

        classes = np.arange(len(labels))
        pylab.xticks(classes, labels)
        pylab.yticks(classes, labels)

        pylab.ylabel('Expected label')
        pylab.xlabel('Predicted label') 
开发者ID:tonybeltramelli,项目名称:Deep-Spying,代码行数:22,代码来源:View.py

示例4: plot_barchart

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_barchart(self, data, labels, colors, xlabel, ylabel, xticks, legendloc=1):
        self.big_figure()

        index = np.arange(len(data[0][0]))
        bar_width = 0.25

        pylab.grid("on", axis='y')
        pylab.ylim([0.5, 1.0])

        for i in range(0, len(data)):
            rects = pylab.bar(bar_width / 2 + index + (i * bar_width), data[i][0], bar_width,
                              alpha=0.5, color=colors[i],
                              yerr=data[i][1],
                              error_kw={'ecolor': '0.3'},
                              label=labels[i])

        pylab.legend(loc=legendloc, prop={'size': 12})

        pylab.xlabel(xlabel)
        pylab.ylabel(ylabel)
        pylab.xticks(bar_width / 2 + index + ((bar_width * (len(data[0]) + 1)) / len(data[0])), xticks) 
开发者ID:tonybeltramelli,项目名称:Deep-Spying,代码行数:23,代码来源:View.py

示例5: plot_functional_map

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_functional_map(C, newfig=True):
    vmax = max(np.abs(C.max()), np.abs(C.min()))
    vmin = -vmax
    C = ((C - vmin) / (vmax - vmin)) * 2 - 1
    if newfig:
        pl.figure(figsize=(5,5))
    else:
        pl.clf()
    ax = pl.gca()
    pl.pcolor(C[::-1], edgecolor=(0.9, 0.9, 0.9, 1), lw=0.5,
              vmin=-1, vmax=1, cmap=nice_mpl_color_map())
    # colorbar
    tick_locs   = [-1., 0.0, 1.0]
    tick_labels = ['min', 0, 'max']
    bar = pl.colorbar()
    bar.locator = matplotlib.ticker.FixedLocator(tick_locs)
    bar.formatter = matplotlib.ticker.FixedFormatter(tick_labels)
    bar.update_ticks()
    ax.set_aspect(1)
    pl.xticks([])
    pl.yticks([])
    if newfig:
        pl.show() 
开发者ID:tneumann,项目名称:cmm,代码行数:25,代码来源:functional_map.py

示例6: i1RepeatNucleotides

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def i1RepeatNucleotides(data, label=''):
    merged_data = mergeWithIndelData(data)
    nt_mean_percs, nts = [], ['A','T','G','C']
    for nt in nts:
        nt_data  = merged_data.loc[merged_data['Repeat Nucleotide Left'] == nt]  
        nt_mean_percs.append((nt_data['I1_Rpt Left Reads - NonAmb']*100.0/nt_data['Total reads']).mean())
    PL.figure(figsize=(3,3))
    PL.bar(range(4),nt_mean_percs)
    for i in range(4):
        PL.text(i-0.25,nt_mean_percs[i]+0.8,'%.1f' % nt_mean_percs[i])
    PL.xticks(range(4),nts)
    PL.ylim((0,26))
    PL.xlabel('PAM distal nucleotide\nadjacent to the cut site')
    PL.ylabel('I1 repeated left nucleotide\nas percent of total mutated reads')
    PL.show(block=False)
    saveFig('i1_rtp_nt_%s' % label) 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:18,代码来源:plot_i1_summaries.py

示例7: plotMergedI1Repeats

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plotMergedI1Repeats(all_result_outputs, label=''):
    merged_data = mergeSamples(all_result_outputs, ['I1_Rpt Left Reads - NonAmb','Total reads'], data_label='i1IndelData', merge_on=['Oligo Id','Repeat Nucleotide Left'])
    nt_mean_percs, nts = [], ['A','T','G','C']
    for nt in nts:
        nt_data  = merged_data.loc[merged_data['Repeat Nucleotide Left'] == nt]  
        nt_mean_percs.append((nt_data['I1_Rpt Left Reads - NonAmb Sum']*100.0/nt_data['Total reads Sum']).mean())
    PL.figure(figsize=(3,3))
    PL.bar(range(4),nt_mean_percs)
    for i in range(4):
        PL.text(i-0.25,nt_mean_percs[i]+0.8,'%.1f' % nt_mean_percs[i])
    PL.xticks(range(4),nts)
    PL.ylim((0,26))
    PL.xlabel('PAM distal nucleotide\nadjacent to the cut site')
    PL.ylabel('I1 repeated left nucleotide\nas percent of total mutated reads')
    PL.show(block=False)
    saveFig('i1_rtp_nt') 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:18,代码来源:plot_i1_summaries.py

示例8: compareMHK562lines

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def compareMHK562lines(all_result_outputs, label='', y_axis = 'Percent Non-Null Reads', data_label='RegrLines'):

    dirnames = [x[1] for x in all_result_outputs]
    clrs = ['silver','grey','darkgreen','green','lightgreen','royalblue','dodgerblue','skyblue','mediumpurple','orchid','red','orange','salmon']

    fig = PL.figure(figsize=(6,6))
    leg_handles = []
    mh_lens = [3,4,5,6,7,8,9,10,11,12,13,14,15]
    for mh_len, clr in zip(mh_lens,clrs):
        regr_lines = [x[0][data_label][mh_len] for x in all_result_outputs]
        mean_line = np.mean([x[:2] for x in regr_lines], axis=0)
        leg_handles.append(PL.plot(mean_line[0], mean_line[1], label='MH Len=%d  (R=%.1f)' % (mh_len,np.mean([x[2] for x in regr_lines])) , linewidth=2, color=clr )[0])
    PL.xlabel('Distance between nearest ends of\nmicrohomologous sequences',fontsize=16)
    PL.ylabel('Correspondng microhomology-mediated deletion\n as percent of total mutated reads',fontsize=16)
    PL.tick_params(labelsize=16)
    PL.legend(handles=[x for x in reversed(leg_handles)], loc='upper right')
    PL.ylim((0,80))
    PL.xlim((0,20))
    PL.xticks(range(0,21,5))
    PL.show(block=False)  
    saveFig('mh_regr_lines_K562') 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:23,代码来源:plot_mh_analysis.py

示例9: plotInFrame

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plotInFrame(overbeek_inframes, ours_inframes, oof_sel_overbeek_ids, pred_results_dir):

    PL.figure(figsize=(4.2,4.2))
    data = pd.read_csv(pred_results_dir + '/old_new_kl_predicted_summaries.txt', sep='\t').fillna(-1.0)
    label1, label2 = 'New 2x800x In Frame Perc', 'New 1600x In Frame Perc'
    xdata, ydata = data[label1], data[label2]
    PL.plot(xdata,ydata, '.', label='Synthetic between library (R=%.2f)' %  pearsonr(xdata,ydata)[0], color='C0',alpha=0.15)
    PL.plot(overbeek_inframes, ours_inframes, '^', label='Synthetic vs Endogenous (R=%.2f)' % pearsonr(overbeek_inframes, ours_inframes)[0], color='C1')
    for (x,y,id) in zip(overbeek_inframes, ours_inframes, oof_sel_overbeek_ids):
        if abs(x-y) > 25.0: PL.text(x,y,id)
    PL.plot([0,100],[0,100],'k--')
    PL.ylabel('Percent In-Frame Mutations')
    PL.xlabel('Percent In-Frame Mutations')
    PL.legend()
    PL.xticks([],[])
    PL.yticks([],[])
    PL.show(block=False)
    saveFig('in_frame_full_scatter') 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:20,代码来源:compare_overbeek_profiles.py

示例10: plotKLBoxes

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plotKLBoxes(data):
    cols = [x for x in data.columns if 'KL' in x and 'Class KL' not in x and 'Old' not in x and 'Conventional' not in x and 'Combined' not in x]
    cols.reverse()
    cols_label, max_kl = 'KL', 9
    PL.figure(figsize=(4,5))

    pt = data.loc[(data['Combined v Predicted KL'] > 0.75) & (data['Combined v Predicted KL'] < 0.8) & (data['Old v New KL'] > 0.75) & (data['Old v New KL'] < 0.8)]
    print(pt['Old Oligo Id'])

    PL.boxplot([data[col] for col in cols], positions=range(len(cols)),patch_artist=True,boxprops=dict(facecolor='C2'),medianprops=dict(linewidth=2.5, color='C1'),showfliers=False)
    PL.xticks(range(len(cols)),[renameCol(x) for x in cols], rotation='vertical')
    for i,col in enumerate(cols):
        PL.text(i-0.15, np.median(data[col])+0.02, '%.2f' % np.median(data[col]))
    PL.ylabel(cols_label)
    PL.subplots_adjust(left=0.1,right=0.95,top=0.95, bottom=0.5)
    PL.show(block=False)
    saveFig('kl_compare_old_new_predicted_%s' % cols_label.replace(' ','')) 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:19,代码来源:plot_old_new_predictions.py

示例11: plotVerticalHistSummary

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plotVerticalHistSummary(all_result_outputs, label='', data_label='', y_label='', plot_label='', hist_width=1000, hist_bins=100, oligo_id_str='Oligo ID', val_str = 'Cut Rate', total_reads_str= 'Total Reads'):
   
    datas = [x[0][data_label][0] for x in all_result_outputs]
    sample_names = [shortDirLabel(x[1]) for x in all_result_outputs]
    
    merged_data = pd.merge(datas[0],datas[1],how='inner',on=oligo_id_str, suffixes=['', ' 2'])
    for i, data in enumerate(datas[2:]):
        merged_data = pd.merge(merged_data, data,how='inner',on=oligo_id_str, suffixes=['', ' %d' % (i+3)])
    suffix = lambda i: ' %d' % (i+1) if i > 0 else ''

    xpos = [x*hist_width for x in range(len(sample_names))]

    PL.figure(figsize=(12,8))
    for i,label1 in enumerate(sample_names):
        dvs = merged_data[val_str + suffix(i)]
        PL.hist(dvs, bins=hist_bins, bottom=i*hist_width, orientation='horizontal')
    PL.xticks(xpos, sample_names, rotation='vertical')
    PL.ylabel(y_label)   
    PL.title(label)
    PL.show(block=False)
    PL.savefig(getPlotDir() + '/%s_%s.png' % (plot_label, label.replace(' ','_')), bbox_inches='tight') 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:23,代码来源:plot.py

示例12: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot(self):
        import pylab as plt

        q_ticks_int = [self.q_dist[i] for i in self.q_ticks]
        q_ticks_label = self.q_labels
        for i, q in enumerate(q_ticks_label):
            if q in self.translate_to_pylab:
                q_ticks_label[i] = self.translate_to_pylab[q]
        plt.plot(self.q_dist, self.ew_list)
        plt.xticks(q_ticks_int, q_ticks_label)
        for x in q_ticks_int:
            plt.axvline(x, color="black")
        return plt 
开发者ID:pyiron,项目名称:pyiron,代码行数:15,代码来源:bandstructure.py

示例13: plot

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot(self, filename=None, vmin=None, vmax=None, cmap='jet_r'):
        import pylab
        pylab.clf()
        pylab.imshow(-np.log10(self.results[self._start_y:,:]), 
            origin="lower",
            aspect="auto", cmap=cmap, vmin=vmin, vmax=vmax)
        pylab.colorbar()

        # Fix xticks
        XMAX = float(self.results.shape[1])  # The max integer on xaxis
        xpos = list(range(0, int(XMAX), int(XMAX/5)))
        xx = [int(this*100)/100 for this in np.array(xpos) / XMAX * self.duration]
        pylab.xticks(xpos, xx, fontsize=16)

        # Fix yticks
        YMAX = float(self.results.shape[0])  # The max integer on xaxis
        ypos = list(range(0, int(YMAX), int(YMAX/5)))
        yy = [int(this) for this in np.array(ypos) / YMAX * self.sampling]
        pylab.yticks(ypos, yy, fontsize=16)

        #pylab.yticks([1000,2000,3000,4000], [5500,11000,16500,22000], fontsize=16)
        #pylab.title("%s echoes" %  filename.replace(".png", ""), fontsize=25)
        pylab.xlabel("Time (seconds)", fontsize=25)
        pylab.ylabel("Frequence (Hz)", fontsize=25)
        pylab.tight_layout()
        if filename:
            pylab.savefig(filename) 
开发者ID:cokelaer,项目名称:spectrum,代码行数:29,代码来源:spectrogram.py

示例14: plot_confusion_matrix

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_confusion_matrix(self, label_test, fn_test):

        fn_preds = self.clf.predict(fn_test)
        acc = accuracy_score(label_test, fn_preds)

        cm_ = CM(label_test, fn_preds)
        cm = normalize(cm_.astype(np.float), axis=1, norm='l1')

        fig = pl.figure()
        ax = fig.add_subplot(111)
        cax = ax.matshow(cm)
        fig.colorbar(cax)
        for x in range(len(cm)):
            for y in range(len(cm)):
                ax.annotate(str("%.3f(%d)"%(cm[x][y], cm_[x][y])), xy=(y,x),
                            horizontalalignment='center',
                            verticalalignment='center',
                            fontsize=10)
        cm_cls =np.unique(np.hstack((label_test,fn_preds)))

        cls = []
        for c in cm_cls:
            cls.append(mapping[c])
        pl.yticks(range(len(cls)), cls)
        pl.ylabel('True label')
        pl.xticks(range(len(cls)), cls)
        pl.xlabel('Predicted label')
        pl.title('Mn Confusion matrix (%.3f)'%acc)

        pl.show() 
开发者ID:plastering,项目名称:plastering,代码行数:32,代码来源:active_learning.py

示例15: plot_word_freq_dist

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import xticks [as 别名]
def plot_word_freq_dist(text):
    fd = text.vocab()

    samples = fd.keys()[:50]
    values = [fd[sample] for sample in samples]
    values = [sum(values[:i+1]) * 100.0/fd.N() for i in range(len(values))]
    pylab.title(text.name)
    pylab.xlabel("Samples")
    pylab.ylabel("Cumulative Percentage")
    pylab.plot(values)
    pylab.xticks(range(len(samples)), [str(s) for s in samples], rotation=90)
    pylab.show() 
开发者ID:blackye,项目名称:luscan-devel,代码行数:14,代码来源:wordfreq_app.py


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