當前位置: 首頁>>代碼示例>>Python>>正文


Python pylab.text方法代碼示例

本文整理匯總了Python中pylab.text方法的典型用法代碼示例。如果您正苦於以下問題:Python pylab.text方法的具體用法?Python pylab.text怎麽用?Python pylab.text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pylab的用法示例。


在下文中一共展示了pylab.text方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_proj

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def test_proj():
    import pylab
    M = test_proj_make_M()

    ts = ['%d' % i for i in [0,1,2,3,0,4,5,6,7,4]]
    xs, ys, zs = [0,1,1,0,0, 0,1,1,0,0], [0,0,1,1,0, 0,0,1,1,0], \
            [0,0,0,0,0, 1,1,1,1,1]
    xs, ys, zs = [np.array(v)*300 for v in (xs, ys, zs)]
    #
    test_proj_draw_axes(M, s=400)
    txs, tys, tzs = proj_transform(xs, ys, zs, M)
    ixs, iys, izs = inv_transform(txs, tys, tzs, M)

    pylab.scatter(txs, tys, c=tzs)
    pylab.plot(txs, tys, c='r')
    for x, y, t in zip(txs, tys, ts):
        pylab.text(x, y, t)

    pylab.xlim(-0.2, 0.2)
    pylab.ylim(-0.2, 0.2)

    pylab.show() 
開發者ID:Sterncat,項目名稱:opticspy,代碼行數:24,代碼來源:proj3d.py

示例2: plot_supervised_chart

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def plot_supervised_chart(annotate=False):
    create_base(supervised=True)
    if annotate:
        fontdict = dict(color='r', weight='bold', size=14)
        pl.text(1.9, 4.55, 'X = vec.fit_transform(input)',
                fontdict=fontdict,
                rotation=20, ha='left', va='bottom')
        pl.text(3.7, 3.2, 'clf.fit(X, y)',
                fontdict=fontdict,
                rotation=20, ha='left', va='bottom')
        pl.text(1.7, 1.5, 'X_new = vec.transform(input)',
                fontdict=fontdict,
                rotation=20, ha='left', va='bottom')
        pl.text(6.1, 1.5, 'y_new = clf.predict(X_new)',
                fontdict=fontdict,
                rotation=20, ha='left', va='bottom') 
開發者ID:jakevdp,項目名稱:sklearn_pydata2015,代碼行數:18,代碼來源:ML_flow_chart.py

示例3: i1RepeatNucleotides

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [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

示例4: plotMergedI1Repeats

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [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

示例5: plotInFrame

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [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

示例6: plotInFrameCorr

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def plotInFrameCorr(data):
    
    shi_data = pd.read_csv(getHighDataDir() + '/shi_deepseq_frame_shifts.txt',sep='\t')

    label1, label2 = 'New In Frame Perc', 'Predicted In Frame Per'
    PL.figure(figsize=(4,4))

    xdata, ydata = data[label1], data[label2]
    PL.plot(xdata,ydata, '.',alpha=0.15)
    PL.plot(shi_data['Measured Frame Shift'], shi_data['Predicted Frame Shift'], '^', color='orange')
    for x,y,id in zip(shi_data['Measured Frame Shift'], shi_data['Predicted Frame Shift'],shi_data['ID']):
        if x-y > 10:
            PL.text(x,y,id.split('/')[1][:-21])
    PL.plot([0,100],[0,100],'k--')
    PL.title('R=%.3f' % (pearsonr(xdata, ydata)[0]))
    PL.xlabel('percent in frame mutations (measured)')
    PL.ylabel('percent in frame mutations (predicted)')
    PL.ylim((0,80))
    PL.xlim((0,80))
    PL.show(block=False)
    saveFig('in_frame_corr_%s_%s' % (label1.replace(' ','_'),label2.replace(' ','_'))) 
開發者ID:felicityallen,項目名稱:SelfTarget,代碼行數:23,代碼來源:plot_old_new_predictions.py

示例7: hist_overflow

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def hist_overflow(val, val_max, **kwds):
    """ Make a histogram with an overflow bar above val_max """
    import pylab, numpy

    overflow = len(val[val>=val_max])
    pylab.hist(val[val<val_max], **kwds)

    if 'color' in kwds:
        color = kwds['color']
    else:
        color = None

    if overflow > 0:
        rect = pylab.bar(val_max+0.05, overflow, .5, color=color)[0]
        pylab.text(rect.get_x(),
                   1.10*rect.get_height(), '%s+' % val_max) 
開發者ID:gwastro,項目名稱:pycbc,代碼行數:18,代碼來源:plot.py

示例8: calc_fig_ratio

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def calc_fig_ratio(ncols, nrows, plot_size, verbose=False):
    """
    calculate size ratio for given number of columns (ncols) and rows (nrows) 
    with plot_size as maximum width and length
    """
    ratio = ncols*1./nrows
    if verbose:
        text = " ".join([ncols, nrows, ratio])
        logprint(text, start=False, printing=True)
    if ncols >= nrows:
        figsize_x = plot_size
        figsize_y = plot_size / ratio
    else:
        figsize_x = plot_size * ratio
        figsize_y = plot_size
    return figsize_x, figsize_y 
開發者ID:molbio-dresden,項目名稱:flexidot,代碼行數:18,代碼來源:flexidot_v1.01.py

示例9: concatenate_files

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def concatenate_files(file_list, combi_filename="temp_combined.fasta", verbose=False):
    """
    concatenate content of all files in file_list into a combined file named combi_filename
    """
    out_file = open(combi_filename, 'w')
    text = ""
    for item in file_list:
        if verbose:
            text += item + " "
            print item, 
        # read in_file linewise and write to out_file
        in_file = open(item, 'rb')
        for line in in_file:
            out_file.write(line.strip()+"\n")
        in_file.close()
    out_file.close()
    if verbose:
        logprint(text, start=False, printing=False)
    return combi_filename 
開發者ID:molbio-dresden,項目名稱:flexidot,代碼行數:21,代碼來源:flexidot_v1.01.py

示例10: test_proj_draw_axes

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def test_proj_draw_axes(M, s=1):
    import pylab
    xs, ys, zs = [0, s, 0, 0], [0, 0, s, 0], [0, 0, 0, s]
    txs, tys, tzs = proj_transform(xs, ys, zs, M)
    o, ax, ay, az = (txs[0], tys[0]), (txs[1], tys[1]), \
            (txs[2], tys[2]), (txs[3], tys[3])
    lines = [(o, ax), (o, ay), (o, az)]

    ax = pylab.gca()
    linec = LineCollection(lines)
    ax.add_collection(linec)
    for x, y, t in zip(txs, tys, ['o', 'x', 'y', 'z']):
        pylab.text(x, y, t) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:proj3d.py

示例11: plot_ax

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def plot_ax(dec, name):
    pl.plot([dec[0], dec[0]], [dec[1] - da, dec[1] + da], 'k', alpha=0.5)
    pl.plot([dec[0] - da, dec[0] + da], [dec[1], dec[1]], 'k', alpha=0.5)
    pl.text(dec[0] - .5, dec[1] + 2, name)


##############################################################################
# Fig 1 : plots source and target samples
# --------------------------------------- 
開發者ID:PythonOT,項目名稱:POT,代碼行數:11,代碼來源:plot_otda_jcpot.py

示例12: plot

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def plot(self, bgimage=None):
        import pylab as pl

        self._plot_background(bgimage)
        ax = pl.gca()
        y0, y1 = pl.ylim()
        # r is the width of the thick line we use to show the facade colors
        r = 5
        patch = pl.Rectangle((self.facade_left + r, self.sky_line + r),
                             self.width - 2 * r,
                             self.door_line - self.sky_line - 2 * r,
                             color=self.color, fill=False, lw=2 * r)
        ax.add_patch(patch)

        pl.text((self.facade_right + self.facade_left) / 2.,
                (self.door_line + self.sky_line) / 2.,
                '$\sigma^2={:0.2f}$'.format(self.uncertainty_for_windows()))

        patch = pl.Rectangle((self.facade_left + r, self.door_line + r),
                             self.width - 2 * r,
                             y0 - self.door_line - 2 * r,
                             color=self.mezzanine_color, fill=False, lw=2 * r)
        ax.add_patch(patch)

        # Plot the left and right edges in yellow
        pl.vlines([self.facade_left, self.facade_right], self.sky_line, y0, colors='yellow')

        # Plot the door line and the roof line
        pl.hlines([self.door_line, self.sky_line], self.facade_left, self.facade_right, linestyles='dashed',
                  colors='yellow')

        self.window_grid.plot() 
開發者ID:jfemiani,項目名稱:facade-segmentation,代碼行數:34,代碼來源:megafacade.py

示例13: plot_facade_cuts

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def plot_facade_cuts(self):

        facade_sig = self.facade_edge_scores.sum(0)
        facade_cuts = find_facade_cuts(facade_sig, dilation_amount=self.facade_merge_amount)
        mu = np.mean(facade_sig)
        sigma = np.std(facade_sig)

        w = self.rectified.shape[1]
        pad=10

        gs1 = pl.GridSpec(5, 5)
        gs1.update(wspace=0.5, hspace=0.0)  # set the spacing between axes.

        pl.subplot(gs1[:3, :])
        pl.imshow(self.rectified)
        pl.vlines(facade_cuts, *pl.ylim(), lw=2, color='black')
        pl.axis('off')
        pl.xlim(-pad, w+pad)

        pl.subplot(gs1[3:, :], sharex=pl.gca())
        pl.fill_between(np.arange(w), 0, facade_sig, lw=0, color='red')
        pl.fill_between(np.arange(w), 0, np.clip(facade_sig, 0, mu+sigma), color='blue')
        pl.plot(np.arange(w), facade_sig, color='blue')

        pl.vlines(facade_cuts, facade_sig[facade_cuts], pl.xlim()[1], lw=2, color='black')
        pl.scatter(facade_cuts, facade_sig[facade_cuts])

        pl.axis('off')

        pl.hlines(mu, 0, w, linestyle='dashed', color='black')
        pl.text(0, mu, '$\mu$ ', ha='right')

        pl.hlines(mu + sigma, 0, w, linestyle='dashed', color='gray',)
        pl.text(0, mu + sigma, '$\mu+\sigma$ ', ha='right')
        pl.xlim(-pad, w+pad) 
開發者ID:jfemiani,項目名稱:facade-segmentation,代碼行數:37,代碼來源:megafacade.py

示例14: graph

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import text [as 別名]
def graph(text,text2=''): 
    pl.xticks(())
    pl.yticks(())
    pl.xlim(0,30)
    pl.ylim(0,20) 
    pl.plot([x,x],[0,3])
    pl.text(x,-2,"X");
    pl.text(0,x,"X")
    pl.text(x,x*1.7, text, ha='center', va='center',size=10, alpha=.5) 
    pl.text(-5,10,text2,size=25) 
開發者ID:PacktPublishing,項目名稱:Python-for-Finance-Second-Edition,代碼行數:12,代碼來源:c10_20_6_figures.py


注:本文中的pylab.text方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。