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


Python PlotUtilities.tom_ticks方法代码示例

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


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

示例1: helical_gallery_plot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tom_ticks [as 别名]
def helical_gallery_plot(helical_areas,helical_data,helical_kwargs):
    axs,first_axs,second_axs = [],[],[]
    offset_y = 0.2
    kw_scalebars = [dict(offset_x=0.35,offset_y=offset_y),
                    dict(offset_x=0.35,offset_y=offset_y),
                    dict(offset_x=0.35,offset_y=offset_y)]
    xlims = [ [None,None],[None,None],[None,15]    ]   
    arrow_x = [0.60,0.62,0.55]
    arrow_y = [0.58,0.60,0.45]
    for i,a in enumerate(helical_areas):
        data = helical_data[i]
        kw_tmp = helical_kwargs[i]
        data_landscape = landscape_data(data.landscape)
        # # plot the energy landscape...
        ax_tmp = plt.subplot(1,len(helical_areas),(i+1))
        axs.append(ax_tmp)
        kw_landscape = kw_tmp['kw_landscape']
        color = kw_landscape['color']      
        ax_1, ax_2 = plot_landscape(data_landscape,xlim=xlims[i],
                                    kw_landscape=kw_landscape,
                                    plot_derivative=True)
        first_axs.append(ax_1)                                 
        second_axs.append(ax_2)                    
        PlotUtilities.tom_ticks(ax=ax_2,num_major=5,change_x=False)       
        last_idx = len(helical_areas)-1
        ax_1.annotate("",xytext=(arrow_x[i],arrow_y[i]),textcoords='axes fraction',
                      xy=(arrow_x[i]+0.2,arrow_y[i]),xycoords='axes fraction',
                      arrowprops=dict(facecolor=color,alpha=0.7,
                                      edgecolor="None",width=4,headwidth=10,
                                      headlength=5))
        if (i > 0):
            PlotUtilities.ylabel("")
            PlotUtilities.xlabel("")
        if (i != last_idx):
            ax_2.set_ylabel("")
            PlotUtilities.no_x_label(ax_1)
            PlotUtilities.no_x_label(ax_2)            
        PlotUtilities.title(a.plot_title,color=color)
    normalize_and_set_zeros(first_axs,second_axs)
    # after normalization, add in the scale bars 
    for i,(ax_1,ax_2) in enumerate(zip(first_axs,second_axs)):
        Scalebar.x_scale_bar_and_ticks_relative(unit="nm",width=5,ax=ax_2,
                                                **kw_scalebars[i])
        PlotUtilities.no_x_label(ax_2)     
开发者ID:prheenan,项目名称:Research,代码行数:46,代码来源:main_landscapes.py

示例2: make_image_plot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tom_ticks [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

示例3: tick_style_log

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tom_ticks [as 别名]
def tick_style_log(**kwargs):
    PlotUtilities.tom_ticks(plt.gca(),num_major=3,**kwargs)
开发者ID:prheenan,项目名称:Research,代码行数:4,代码来源:main_performance_figure.py

示例4: run

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

#.........这里部分代码省略.........
    ax_final_prob = plt.subplot(gs[3,:])
    plt.plot(time_plot,to_prob_plot(info_final.cdf),
             **probability_kwargs)    
    title_consistent = (arrow + "Supress small force change events")
    PlotUtilities.lazyLabel("",probability_label_post,title_consistent,**kw)
    PlotUtilities.no_x_label(ax_final_prob)      
    plt.ylim(ylim_prob)    
    plt.xlim(xlim_time)
    Scalebar.x_scale_bar_and_ticks_relative(ax=ax_final_prob,**prob_scale_dict)
    tick_style()
    # # plot the final event locations
    ax_final = plt.subplot(gs[4,:])
    plt.plot(time_plot,force_plot,**raw_force_kwargs)    
    plt.plot(time_plot,force_interp_plot,**interp_force_kwargs)
    PlotUtilities.no_x_label(ax_final)      
    title_final = (arrow + " Extract significant events")
    event_starts = [e.start for e in info_final.event_slices_raw]
    Plotting.plot_arrows_above_events(event_starts,plot_x=time_plot,
                                      plot_y=force_plot,fudge_y=40,
                                      label=None)
    PlotUtilities.lazyLabel("",force_label,title_final,
                            loc = "upper center",**kw)
    plt.ylim(ylim_force_pN)                           
    plt.xlim(xlim_time)
    Scalebar.x_scale_bar_and_ticks_relative(ax=ax_final,**fec_scale_dict)
    tick_style()
    ylim_first_event = [-5,30]
    first_event_window_large = 0.045
    fraction_increase= 5
    color_first = 'm'
    # get the event index, window pct to use, where to show a 'zoom', and the
    # y limits (if none, just all of it)
    event_idx_fudge_and_kw = \
        [ [0 ,first_event_window_large   ,True,ylim_first_event,color_first],
          [0 ,first_event_window_large/fraction_increase,False,
           ylim_first_event,color_first],
          [-1,4e-3,True,[-50,None],'r']]
    widths_seconds = 1e-3 * np.array([50,10,5])
    for i,(event_id,fudge,zoom_bool,ylim,c) in \
        enumerate(event_idx_fudge_and_kw):
        # get how the interpolated plot should be 
        interp_force_kwargs_tmp = dict(**interp_force_kwargs)
        interp_force_kwargs_tmp['color'] = c
        interp_force_kwargs_tmp['linewidth'] = 1.25
        # determine the slice we want to use       
        event_location = info_final.event_idx[event_id]
        event_bounding_slice = slice_window_around(event_location,
                                                   time_plot,fraction=fudge)
        time_first_event_plot = time_plot[event_bounding_slice]
        time_slice = time_first_event_plot
        # # plot the interpolated on the *full plot* before we zoom in (so the
        # # colors match)
        plt.subplot(gs[-2,:])
        plt.plot(time_slice,force_interp_plot[event_bounding_slice],
                 **interp_force_kwargs_tmp)       
        plt.ylim(ylim_force_pN)
        # # next, plot the zoomed version
        in_ax = plt.subplot(gs[-1,i])
        in_ax.plot(time_slice,force_plot[event_bounding_slice],
                   **raw_force_kwargs)
        in_ax.plot(time_slice,force_interp_plot[event_bounding_slice],
                   **interp_force_kwargs_tmp)       
        PlotUtilities.no_x_anything(ax=in_ax)
        # removing  y label on all of them..
        if (i == 0):
            ylabel = force_label
        else:
            ylabel = ""
        # determine if we need to add in 'guidelines' for zooming
        if (zoom_bool):
            PlotUtilities.zoom_effect01(ax_final,in_ax,*in_ax.get_xlim(),
                                        color=c)
            PlotUtilities.lazyLabel("Time (s)",ylabel,"",**kw)
        else:
            # this is a 'second' zoom in...'
            PlotUtilities.no_y_label(in_ax)
            ylabel = ("{:d}x\n".format(fraction_increase)) + \
                      r"$\rightarrow$"
            PlotUtilities.lazyLabel("Time (s)",ylabel,"",**kw)
            PlotUtilities.ylabel(ylabel,rotation=0,labelpad=5)
        # plot an arrow over the (single) event
        Plotting.plot_arrows_above_events([event_location],plot_x=time_plot,
                                          plot_y=force_plot,fudge_y=7,
                                          label=None,markersize=150)
        plt.ylim(ylim)
        common = dict(unit="ms",
                      unit_kwargs=dict(value_function = lambda x: x*1e3))
        width = widths_seconds[i]
        Scalebar.x_scale_bar_and_ticks_relative(offset_y=0.1,offset_x=0.5,
                                                width=width,ax=in_ax,
                                                **common)
        PlotUtilities.tom_ticks(ax=in_ax,num_major=2,change_x=False)
    loc_major = [-0.15,1.2]
    loc_minor = [-0.15,1.15]
    locs = [loc_major for _ in range(5)] + \
           [loc_minor for _ in range(3)]
    PlotUtilities.label_tom(fig,loc=locs)
    subplots_adjust=dict(hspace=0.48,wspace=0.35)
    PlotUtilities.save_png_and_svg(fig,"flowchart",
                                   subplots_adjust=subplots_adjust)
开发者ID:prheenan,项目名称:Research,代码行数:104,代码来源:main_flowchart.py

示例5: tick_style

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tom_ticks [as 别名]
def tick_style(num_major=3):
    ax = plt.gca()
    PlotUtilities.tom_ticks(ax=ax,num_major=num_major,change_x=False)
开发者ID:prheenan,项目名称:Research,代码行数:5,代码来源:main_flowchart.py

示例6: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import tom_ticks [as 别名]
def run():
    """
    <Description>q

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    in_dir = None
    flickering_dir = "../Data/fec/"
    # XXX use the flickering dir for stuff
    cache_dir = flickering_dir 
    GenUtilities.ensureDirExists(flickering_dir)
    force_read_data = False
    raw_data = IoUtilHao.read_and_cache_data_hao(flickering_dir,
                                                force=force_read_data,
                                                 cache_directory=flickering_dir,
                                                 limit=3)
    example = raw_data[0]                                                 
    example_plot = copy.deepcopy(example)
    # fix the manual offset
    example_plot.LowResData.force -= 7.1
    plot_examples = [example_plot]
    vel_m_per_s = example_plot.Velocity
    x_func = lambda y: y.Separation
    y_func = lambda y: y.Force 
    ylim_pN = [-20,155]
    xlim_nm = [5,75]
    zoom_regions_nm = [ [61.5,63.6]]
    adhesion_max_nm = 19
    region_labels = ["ED Helix","CB Helix","A Helix"]
    region_colors = jcp_fig_util.regions_and_colors()
    regions_nm = [[x,l,c] for l,(x,c) in zip(region_labels,region_colors)]
    colors_regions = [regions_nm[-1]]                        
    # slice the regions 
    regions = [FEC_Util.slice_by_separation(example_plot,*reg) 
               for reg in zoom_regions_nm]
    ylim_pN_zoom = [50,120]
    # # make the plot 
    fig = PlotUtilities.figure((7,4))
    # create the 'top' gridspec
    top_spec = gridspec.GridSpec(2,3)
    # create separate axes for the image and FECs 
    image_spec = \
        gridspec.GridSpecFromSubplotSpec(1,1,subplot_spec=top_spec[0,0])
    data_spec = \
        gridspec.GridSpecFromSubplotSpec(1,2,subplot_spec=top_spec[0,1:])
    # # plot the image 
    ax = plt.subplot(image_spec[:])
    plt.imshow(plt.imread("../Data/sample_cartoon.png"),aspect='auto')
    ax.axis('off')
    # # plot the example fec and zoomed regions
    #
    # 'full' example 
    ax_example = plt.subplot(data_spec[:,0])
    alpha_data = 0.4
    color_data = 'g'
    dict_plot = dict(n_filter_points=2000,
                     style_data=dict(color=color_data,alpha=alpha_data,
                                     linewidth=0.5,linestyle='-'))
    x_full_plot = x_func(example_plot)                                     
    FEC_Plot._fec_base_plot(x_full_plot,y_func(example_plot),
                            **dict_plot)
    PlotUtilities.tom_ticks(ax=ax_example,num_major=5,change_x=False)    
    PlotUtilities.tom_ticks(ax=ax_example,num_major=4,change_y=False)                              
    for i,(r,color) in enumerate(zip(regions,colors_regions)):
        # put a box around the region 
        x,y = x_func(r),y_func(r)
        Annotations.add_rectangle(ax_example,[min(x),max(x)],[min(y),max(y)])
    plt.ylim(ylim_pN)
    plt.xlim(xlim_nm)
    jcp_fig_util.add_helical_boxes(ax=ax_example)
    # plot the adhesion regions
    plt.axvspan(min(x_full_plot),adhesion_max_nm,color='0.85',
                linewidth=0)
    PlotUtilities.lazyLabel("Extension","Force","")   
    PlotUtilities.x_label_on_top(ax_example)
    PlotUtilities.no_x_label(ax_example)
    PlotUtilities.no_y_label(ax_example)
    x_kwargs = dict(unit_kwargs=dict(fmt="{:.0f}"),width=15,unit="nm")
    y_kwargs = dict(unit_kwargs=dict(fmt="{:.0f}"),
                    height=40,unit="pN")
    Scalebar.crossed_x_and_y_relative(offset_x=0.55,offset_y=0.58,
                                      x_kwargs=x_kwargs,
                                      y_kwargs=y_kwargs,
                                      ax=ax_example)    
    # add in the velocity annotation (in nm/s, from m/s)
    velocity_annotate(ax=ax_example,v=vel_m_per_s*1e9)
    # # plot all the zoomed regions 
    offsets_x = [0.8]
    offsets_y = [0.67]
    heights_pN = [10]
    widths_s = [0.001]
    for i,(r,color) in enumerate(zip(regions,colors_regions)):
        ax_tmp = plt.subplot(data_spec[-1])
        dict_tmp = dict(**dict_plot)
        dict_tmp['style_data']['color'] = color[-1]
        time = r.Time
#.........这里部分代码省略.........
开发者ID:prheenan,项目名称:Research,代码行数:103,代码来源:main_diagram.py


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