当前位置: 首页>>代码示例>>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;未经允许,请勿转载。