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


Python pylab.xlim方法代碼示例

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


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

示例1: test_lines_dists

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

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

示例6: plot_rectified

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

示例7: plot_original

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

示例8: plot_CDR_correlation

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

示例9: addqqplotinfo

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

示例10: compareMHlines

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import xlim [as 別名]
def compareMHlines(all_result_outputs, label='', y_axis = 'Percent Non-Null Reads', data_label='RegrLines'):

    color_map = {'K562':'b','K562_1600x':'lightblue', 'BOB':'g', 'RPE1':'purple', 'TREX2':'k', 'TREX2_2A':'gray', 'HAP1':'r', 'E14TG2A':'orange','eCAS9':'c', 'WT':'pink', 'CHO':'salmon'}
    lysty_map = {2:'--',3:'--',5:'--',7:'-',10:'-.',16:':',20:':'}

    dirnames = [x[1] for x in all_result_outputs]
    lystys = [lysty_map[parseSampleName(x)[1]] for x in dirnames]
    clrs = [color_map[parseSampleName(x)[0]] for x in dirnames]

    for mh_len in [9]:
        PL.figure()
        regr_lines = [x[0][data_label][mh_len] for x in all_result_outputs]
        for dirname, regr_line,lysty,clr in zip(dirnames,regr_lines,lystys, clrs):
            PL.plot(regr_line[0], regr_line[1], label='%s (R=%.1f)' % (getSimpleName(dirname), regr_line[2]), linewidth=2, color=clr, linestyle=lysty, alpha=0.5 )
        PL.xlabel('Distance between nearest ends of microhomologous sequences',fontsize=14)
        PL.ylabel('Corresponding microhomology-mediated deletion\n as percent of total mutated reads',fontsize=14)
        PL.tick_params(labelsize=16)
        PL.legend(loc='upper right')
        PL.ylim((0,70))
        PL.xlim((0,20))
        PL.xticks(range(0,21,5))
        PL.title('Microhomology Length %d' % mh_len,fontsize=18)
        PL.show(block=False)  
        saveFig('mh_regr_lines_all_samples__%d' % mh_len) 
開發者ID:felicityallen,項目名稱:SelfTarget,代碼行數:26,代碼來源:plot_mh_analysis.py

示例11: compareMHK562lines

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

示例12: plotInFrameCorr

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

示例13: plot

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import xlim [as 別名]
def plot(t, plots, shot_ind):
    n = len(plots)

    for i in range(0,n):
        label, data = plots[i]

        plt = py.subplot(n, 1, i+1)
        plt.tick_params(labelsize=8)
        py.grid()
        py.xlim([t[0], t[-1]])
        py.ylabel(label)

        py.plot(t, data, 'k-')
        py.scatter(t[shot_ind], data[shot_ind], marker='*', c='g')

    py.xlabel("Time")
    py.show()
    py.close() 
開發者ID:sealneaward,項目名稱:nba-movement-data,代碼行數:20,代碼來源:fix_shot_times.py

示例14: draw_graph_row

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import xlim [as 別名]
def draw_graph_row(graphs,
                   index=0,
                   contract=True,
                   n_graphs_per_line=5,
                   size=4,
                   xlim=None,
                   ylim=None,
                   **args):
    """draw_graph_row."""
    dim = len(graphs)
    size_y = size
    size_x = size * n_graphs_per_line * args.get('size_x_to_y_ratio', 1)
    plt.figure(figsize=(size_x, size_y))

    if xlim is not None:
        plt.xlim(xlim)
        plt.ylim(ylim)
    else:
        plt.xlim(xmax=3)

    for i in range(dim):
        plt.subplot(1, n_graphs_per_line, i + 1)
        graph = graphs[i]
        draw_graph(graph,
                   size=None,
                   pos=graph.graph.get('pos_dict', None),
                   **args)
    if args.get('file_name', None) is None:
        plt.show()
    else:
        row_file_name = '%d_' % (index) + args['file_name']
        plt.savefig(row_file_name,
                    bbox_inches='tight',
                    transparent=True,
                    pad_inches=0)
        plt.close() 
開發者ID:fabriziocosta,項目名稱:EDeN,代碼行數:38,代碼來源:__init__.py

示例15: plot_precision_recall_curve

# 需要導入模塊: import pylab [as 別名]
# 或者: from pylab import xlim [as 別名]
def plot_precision_recall_curve(y_true, y_score, size=None):
    """plot_precision_recall_curve."""
    precision, recall, thresholds = precision_recall_curve(y_true, y_score)
    if size is not None:
        plt.figure(figsize=(size, size))
        plt.axis('equal')
    plt.plot(recall, precision, lw=2, color='navy')
    plt.xlabel('Recall')
    plt.ylabel('Precision')
    plt.ylim([-0.05, 1.05])
    plt.xlim([-0.05, 1.05])
    plt.grid()
    plt.title('Precision-Recall AUC={0:0.2f}'.format(average_precision_score(
        y_true, y_score))) 
開發者ID:fabriziocosta,項目名稱:EDeN,代碼行數:16,代碼來源:__init__.py


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