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


Python pylab.ylim方法代码示例

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


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

示例1: test_lines_dists

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def test_lines_dists():
    import pylab
    ax = pylab.gca()

    xs, ys = (0,30), (20,150)
    pylab.plot(xs, ys)
    points = list(zip(xs, ys))
    p0, p1 = points

    xs, ys = (0,0,20,30), (100,150,30,200)
    pylab.scatter(xs, ys)

    dist = line2d_seg_dist(p0, p1, (xs[0], ys[0]))
    dist = line2d_seg_dist(p0, p1, np.array((xs, ys)))
    for x, y, d in zip(xs, ys, dist):
        c = Circle((x, y), d, fill=0)
        ax.add_patch(c)

    pylab.xlim(-200, 200)
    pylab.ylim(-200, 200)
    pylab.show() 
开发者ID:Sterncat,项目名称:opticspy,代码行数:23,代码来源:proj3d.py

示例2: test_proj

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

示例3: plot_roc_curve

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def plot_roc_curve(y_true, y_score, size=None):
    """plot_roc_curve."""
    false_positive_rate, true_positive_rate, thresholds = roc_curve(
        y_true, y_score)
    if size is not None:
        plt.figure(figsize=(size, size))
        plt.axis('equal')
    plt.plot(false_positive_rate, true_positive_rate, lw=2, color='navy')
    plt.plot([0, 1], [0, 1], color='gray', lw=1, linestyle='--')
    plt.xlabel('False positive rate')
    plt.ylabel('True positive rate')
    plt.ylim([-0.05, 1.05])
    plt.xlim([-0.05, 1.05])
    plt.grid()
    plt.title('Receiver operating characteristic AUC={0:0.2f}'.format(
        roc_auc_score(y_true, y_score))) 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:18,代码来源:__init__.py

示例4: test_lines_dists

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def test_lines_dists():
    import pylab
    ax = pylab.gca()

    xs, ys = (0,30), (20,150)
    pylab.plot(xs, ys)
    points = zip(xs, ys)
    p0, p1 = points

    xs, ys = (0,0,20,30), (100,150,30,200)
    pylab.scatter(xs, ys)

    dist = line2d_seg_dist(p0, p1, (xs[0], ys[0]))
    dist = line2d_seg_dist(p0, p1, np.array((xs, ys)))
    for x, y, d in zip(xs, ys, dist):
        c = Circle((x, y), d, fill=0)
        ax.add_patch(c)

    pylab.xlim(-200, 200)
    pylab.ylim(-200, 200)
    pylab.show() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:23,代码来源:proj3d.py

示例5: plot_Geweke

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def plot_Geweke(parameterdistribution,parametername):
    '''Input:  Takes a list of sampled values for a parameter and his name as a string
       Output: Plot as seen for e.g. in BUGS or PyMC'''
    import matplotlib.pyplot as plt

    # perform the Geweke test
    Geweke_values = _Geweke(parameterdistribution)

    # plot the results
    fig = plt.figure()
    plt.plot(Geweke_values,label=parametername)
    plt.legend()
    plt.title(parametername + '- Geweke_Test')
    plt.xlabel('Subinterval')
    plt.ylabel('Geweke Test')
    plt.ylim([-3,3])

    # plot the delimiting line
    plt.plot( [2]*len(Geweke_values), 'r-.')
    plt.plot( [-2]*len(Geweke_values), 'r-.') 
开发者ID:thouska,项目名称:spotpy,代码行数:22,代码来源:analyser.py

示例6: _plot_background

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def _plot_background(self, bgimage):
        import pylab as pl
        # Show the portion of the image behind this facade
        left, right = self.facade_left, self.facade_right
        top, bottom = 0, self.mega_facade.rectified.shape[0]
        if bgimage is not None:
            pl.imshow(bgimage[top:bottom, left:right], extent=(left, right, bottom, top))
        else:
            # Fit the facade in the plot
            y0, y1 = pl.ylim()
            x0, x1 = pl.xlim()
            x0 = min(x0, left)
            x1 = max(x1, right)
            y0 = min(y0, top)
            y1 = max(y1, bottom)
            pl.xlim(x0, x1)
            pl.ylim(y1, y0) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:19,代码来源:megafacade.py

示例7: plot_rectified

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def plot_rectified(self):
        import pylab
        pylab.title('rectified')
        pylab.imshow(self.rectified)

        for line in self.vlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            p0 = self.inv_transform(p0)
            p1 = self.inv_transform(p1)
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:24,代码来源:rectify.py

示例8: plot_original

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def plot_original(self):
        import pylab
        pylab.title('original')
        pylab.imshow(self.data)

        for line in self.lines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='blue', alpha=0.3)

        for line in self.vlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='green')

        for line in self.hlines:
            p0, p1 = line
            pylab.plot((p0[0], p1[0]), (p0[1], p1[1]), c='red')

        pylab.axis('image');
        pylab.grid(c='yellow', lw=1)
        pylab.plt.yticks(np.arange(0, self.l, 100.0));
        pylab.xlim(0, self.w)
        pylab.ylim(self.l, 0) 
开发者ID:jfemiani,项目名称:facade-segmentation,代码行数:24,代码来源:rectify.py

示例9: plot_CDR_correlation

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def plot_CDR_correlation(self, doplot=True):
        """
        Displays correlation between sampling time points and CDR. It returns the two
        parameters of the linear fit, Pearson's r, p-value and standard error. If optional argument 'doplot' is
        False, the plot is not displayed.
        """
        pel2, tol = self.get_gene(self.rootlane, ignore_log=True)
        pel = numpy.array([pel2[m] for m in self.pl])*tol
        dr2 = self.get_gene('_CDR')[0]
        dr = numpy.array([dr2[m] for m in self.pl])
        po = scipy.stats.linregress(pel, dr)
        if doplot:
            pylab.scatter(pel, dr, s=9.0, alpha=0.7, c='r')
            pylab.xlim(min(pel), max(pel))
            pylab.ylim(0, max(dr)*1.1)
            pylab.xlabel(self.rootlane)
            pylab.ylabel('CDR')
            xk = pylab.linspace(min(pel), max(pel), 50)
            pylab.plot(xk, po[1]+po[0]*xk, 'k--', linewidth=2.0)
            pylab.show()
        return po 
开发者ID:CamaraLab,项目名称:scTDA,代码行数:23,代码来源:main.py

示例10: plot_barchart

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

示例11: addqqplotinfo

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import ylim [as 别名]
def addqqplotinfo(qnull,M,xl='-log10(P) observed',yl='-log10(P) expected',xlim=None,ylim=None,alphalevel=0.05,legendlist=None,fixaxes=False):    
    distr='log10'
    pl.plot([0,qnull.max()], [0,qnull.max()],'k')
    pl.ylabel(xl)
    pl.xlabel(yl)
    if xlim is not None:
        pl.xlim(xlim)
    if ylim is not None:
        pl.ylim(ylim)        
    if alphalevel is not None:
        if distr == 'log10':
            betaUp, betaDown, theoreticalPvals = _qqplot_bar(M=M,alphalevel=alphalevel,distr=distr)
            lower = -sp.log10(theoreticalPvals-betaDown)
            upper = -sp.log10(theoreticalPvals+betaUp)
            pl.fill_between(-sp.log10(theoreticalPvals),lower,upper,color="grey",alpha=0.5)
            #pl.plot(-sp.log10(theoreticalPvals),lower,'g-.')
            #pl.plot(-sp.log10(theoreticalPvals),upper,'g-.')
    if legendlist is not None:
        leg = pl.legend(legendlist, loc=4, numpoints=1)
        # set the markersize for the legend
        for lo in leg.legendHandles:
            lo.set_markersize(10)

    if fixaxes:
        fix_axes() 
开发者ID:MicrosoftResearch,项目名称:Azimuth,代码行数:27,代码来源:util.py

示例12: i1RepeatNucleotides

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

示例13: plotMergedI1Repeats

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

示例14: compareMHK562lines

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

示例15: plotInFrameCorr

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


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