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


Python PlotUtilities.upright_mu方法代码示例

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


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

示例1: make_image_plot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import upright_mu [as 别名]
def make_image_plot(im,imshow_kwargs=dict(cmap=plt.cm.afmhot),pct=50):
    """
    Given an image object, makes a sensible plot 
    
    Args:
        im: PxpLoader.SurfaceImage object
        imshow_kwargs: passed directly to plt.imshow 
        pct: where to put 'zero' default to median (probably the surface
    Returns:
        output of im_show
    """
    # offset the data
    im_height = im.height_nm()
    min_offset = np.percentile(im_height,pct)
    im_height -= min_offset
    range_microns = im.range_meters * 1e6
    to_ret = plt.imshow(im_height.T,extent=[0,range_microns,0,range_microns],
                        interpolation='bicubic',**imshow_kwargs)
    PlotUtilities.tom_ticks()
    micron_str = PlotUtilities.upright_mu("m")
    PlotUtilities.lazyLabel(micron_str,micron_str,"",
                            tick_kwargs=dict(direction='out'))    
    return to_ret                                 
开发者ID:prheenan,项目名称:Research,代码行数:25,代码来源:ImageUtil.py

示例2: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import upright_mu [as 别名]

#.........这里部分代码省略.........
        PlotUtilities.no_x_label(ax_tmp)
        PlotUtilities.x_label_on_top(ax_tmp)        
        PlotUtilities.lazyLabel("","","")        
        PlotUtilities.xlabel("Time")
    # read in the data ...
    base_re = "./recreation_figure_data/"
    # # Figure 1D from the science paper 
    ax_fec_ensemble = plt.subplot(top_spec[1,0])
    fig4d = figure_recreation.save_output(base_re,"Fig1D.csv")      
    ylim = [0,160]
    xlim = [18,32]
    for wlc_x,wlc_y in zip(fig4d.wlc_x,fig4d.wlc_y):
        plt.plot(wlc_x,wlc_y,'b--',alpha=0.4,linewidth=1,dashes=(2,2))
    for x,y in zip(fig4d.x,fig4d.y):
        plt.plot(x,y,alpha=1,linewidth=0.5)        
    ax_fec_ensemble.set_ylim(ylim)
    ax_fec_ensemble.set_xlim(xlim)    
    PlotUtilities.lazyLabel("Extension","Force","")        
    x_kwargs = dict(width=3,unit="nm")
    y_font = copy.deepcopy(Scalebar.def_font_kwargs_y)
    y_font['rotation'] = 90
    y_kwargs = dict(height=25,unit="pN",font_kwargs=y_font)
    Scalebar.crossed_x_and_y_relative(offset_x=0.22,offset_y=0.77,
                                      x_kwargs=x_kwargs,
                                      y_kwargs=y_kwargs,
                                      ax=ax_fec_ensemble)    
    PlotUtilities.no_x_label(ax=ax_fec_ensemble)                                      
    PlotUtilities.no_y_label(ax=ax_fec_ensemble)  
    # # Figure 4B from the science paper
    color_equil = 'rebeccapurple'
    fig4ab = figure_recreation.save_output(base_re,"Fig4AB.csv")  
    ax_time = plt.subplot(top_spec[1,1])
    min_x,max_x = min(fig4ab.time),max(fig4ab.time)
    range = [0.55,0.59]
    min_x_new = min_x + (max_x-min_x)*range[0]
    max_x_new = min_x + (max_x-min_x)*range[1]
    idx = np.where( (fig4ab.time <= max_x_new) & (fig4ab.time >= min_x_new))
    time = fig4ab.time[idx]
    force = fig4ab.force[idx]
    FEC_Plot._fec_base_plot(time,force,n_filter_points=200,
                            style_data=dict(color=color_equil,alpha=0.3,
                                            linewidth=0.75))
    ax_time.set_xlim(min_x_new,max_x_new)
    ax_time.set_ylim(None,None)
    unit_kwargs = dict(value_function =lambda x: x*1e6,fmt="{:.0f}")
    unit_micro_s = PlotUtilities.upright_mu() + "m"
    x_kwargs = dict(unit_kwargs=unit_kwargs,width=500e-6,unit=unit_micro_s)
    y_font = copy.deepcopy(Scalebar.def_font_kwargs_y)
    y_font['rotation'] = 90
    y_kwargs = dict(height=10,unit="pN",font_kwargs=y_font)
    Scalebar.crossed_x_and_y_relative(offset_x=0.5,offset_y=0.08,
                                      x_kwargs=x_kwargs,
                                      y_kwargs=y_kwargs,
                                      ax=ax_time)  
    PlotUtilities.no_x_label(ax=ax_time)                                      
    PlotUtilities.no_y_label(ax=ax_time)  
    PlotUtilities.lazyLabel("Time","Force","")
    velocity_annotate(ax=ax_time,v=0,color=color_equil)
    # # figure 4C from the science paper -- the pfold energy landscape 
    fig4c = figure_recreation.save_output(base_re,"Fig4C.csv")
    ax_equil = plt.subplot(top_spec[1,2])
    # data is in kJ/mol, communication with hao, 2017-9-14
    fig4c.energy /= 4.2
    fig4c.energy_error /= 4.2
    plt.errorbar(fig4c.x,fig4c.energy,fig4c.energy_error,color=color_equil,
                 marker='o',
                 mfc='w',zorder=0,markerfacecolor="None",capsize=2,elinewidth=1,
                 linewidth=1)                 
    PlotUtilities.lazyLabel("Extension (nm)","Energy","")     
    x_kwargs = dict(unit_kwargs=dict(fmt="{:.1f}"),width=0.1,unit="nm")
    y_font = copy.deepcopy(Scalebar.def_font_kwargs_y)
    y_font['rotation'] = 90
    y_kwargs = dict(unit_kwargs=dict(fmt="{:.1f}"),
                    height=0.5,unit="kcal/mol",font_kwargs=y_font)
    Scalebar.crossed_x_and_y_relative(offset_x=0.22,offset_y=0.60,
                                      x_kwargs=x_kwargs,
                                      y_kwargs=y_kwargs,
                                      ax=ax_equil)
    # add in bell...
    bell_mean = 0.64
    bell_std = 0.09
    x0,xf = ax_equil.get_xlim()
    mean_x = bell_mean * (xf-x0) + x0
    std_x = bell_std * (xf-x0)
    color_bell = 'k'
    plt.axvspan(mean_x-std_x,mean_x+std_x,color=color_bell,alpha=0.15)
    plt.axvline(mean_x,color=color_bell,linestyle='--',zorder=0,alpha=0.7)
    PlotUtilities.no_x_label(ax=ax_equil)         
    t = ax_equil.annotate(s=r"$\Delta x^{\ddag}_{\mathrm{Bell}}$",
                          xy=(0.4,0.3),color=color_bell,
                          xycoords="axes fraction")
    PlotUtilities.no_y_label(ax=ax_equil)    
    loc_upper = [-0.05,1.05]
    loc_lower = [-0.05,1.0]
    loc = [loc_upper,loc_upper,loc_upper,   
           loc_lower,loc_lower,loc_lower]
    PlotUtilities.label_tom(fig,loc=loc)
    subplots_adjust = dict(hspace=0.07,wspace=0.15)
    PlotUtilities.save_png_and_svg(fig,"diagram",
                                   subplots_adjust=subplots_adjust)
开发者ID:prheenan,项目名称:Research,代码行数:104,代码来源:main_diagram.py


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