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


Python pylab.tick_params方法代码示例

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


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

示例1: compareMHlines

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

示例2: compareMHK562lines

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

示例3: embed

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import tick_params [as 别名]
def embed(words, matrix, classes, usermodel, fname):
    perplexity = int(len(words) ** 0.5)  # We set perplexity to a square root of the words number
    embedding = TSNE(n_components=2, perplexity=perplexity, metric='cosine', n_iter=500, init='pca')
    y = embedding.fit_transform(matrix)

    print('2-d embedding finished', file=sys.stderr)

    class_set = [c for c in set(classes)]
    colors = plot.cm.rainbow(np.linspace(0, 1, len(class_set)))

    class2color = [colors[class_set.index(w)] for w in classes]

    xpositions = y[:, 0]
    ypositions = y[:, 1]
    seen = set()

    plot.clf()

    for color, word, class_label, x, y in zip(class2color, words, classes, xpositions, ypositions):
        plot.scatter(x, y, 20, marker='.', color=color,
                     label=class_label if class_label not in seen else "")
        seen.add(class_label)

        lemma = word.split('_')[0].replace('::', ' ')
        mid = len(lemma) / 2
        mid *= 4  # TODO Should really think about how to adapt this variable to the real plot size
        plot.annotate(lemma, xy=(x - mid, y), size='x-large', weight='bold', fontproperties=font,
                      color=color)

    plot.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False)
    plot.tick_params(axis='y', which='both', left=False, right=False, labelleft=False)
    plot.legend(loc='best')

    plot.savefig(root + 'data/images/tsneplots/' + usermodel + '_' + fname + '.png', dpi=150,
                 bbox_inches='tight')
    plot.close()
    plot.clf() 
开发者ID:akutuzov,项目名称:webvectors,代码行数:39,代码来源:plotting.py

示例4: plotPercScatterAnalysis

# 需要导入模块: import pylab [as 别名]
# 或者: from pylab import tick_params [as 别名]
def plotPercScatterAnalysis(data, label='test', y_axis = 'Percent Non-Null Reads', plot_scatters=False, plot_regr_lines=False, scatter_mh_lens=[], mh_lens=[9]):
    
    plot_dir = getPlotDir()
    regr_lines = {}
    for mh_len in mh_lens:
        mh_data = data.loc[data['MH Len'] == mh_len]
        mh_rdata = mh_data.loc[(mh_data['MH Dist'] >= 0) & (mh_data['MH Dist'] < (30-mh_len)) ]
        
        regr = linear_model.LinearRegression()
        rx, ry = mh_rdata[['MH Dist']], mh_rdata[[y_axis]] #np.log(mh_rdata[[y_axis]])
        regr.fit(rx, ry)
        corr = scipy.stats.pearsonr(rx, ry)
        min_x, max_x = rx.min()[0], rx.max()[0]
        x_pts = [min_x, max_x]
        regr_lines[mh_len] = (x_pts,[regr.predict(x)[0] for x in x_pts],corr[0])
        
        if plot_scatters and mh_len in scatter_mh_lens:
            fig = PL.figure(figsize=(5,5))
            PL.plot( mh_data['MH Dist'], mh_data[y_axis], '.', alpha=0.4 )
            PL.plot(regr_lines[mh_len][0],regr_lines[mh_len][1],'dodgerblue',linewidth=3)
        
            PL.xlabel('Distance between nearest ends of\nmicrohomologous sequences',fontsize=14)
            PL.ylabel('Percent of mutated reads of corresponding\nMH-mediated deletion',fontsize=14)
            PL.tick_params(labelsize=14)
            PL.xlim((0,20))
            PL.title('Microhomology of length %d (r=%.2f)' % (mh_len,corr[0]),fontsize=14)
            PL.show(block=False)  
            saveFig('mh_scatter_len%d_%s' % (mh_len,label.split('/')[-1])) 
    
    if plot_regr_lines:
        fig = PL.figure()
        output_data = {}
        for mh_len in mh_lens:
            fit_data = regr_lines[mh_len]
            if mh_len > 15:
                continue
            lsty = '--' if mh_len < 9 else '-'
            PL.plot(fit_data[0], fit_data[1], linewidth=2, linestyle=lsty, label='MH length %d (R=%.1f)' % (mh_len, fit_data[2]))
        PL.title(label,fontsize=18)
        PL.xlabel('Distance between nearest ends of\nmicrohomologous sequences',fontsize=14)
        PL.ylabel('Percent of mutated reads of corresponding\nMH-mediated deletion',fontsize=14)
          
        PL.tick_params(labelsize=18)
        PL.legend()
        PL.ylim((0,100))
        PL.show(block=False)  
        saveFig(plot_dir + '/mh_scatter_all_len_%s' % label.split('/')[-1]) 
    return regr_lines 
开发者ID:felicityallen,项目名称:SelfTarget,代码行数:50,代码来源:plot_mh_analysis.py


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