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


Python PlotUtilities.savefig方法代码示例

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


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

示例1: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    network = FEC_Util.default_data_root()
    base = network + "4Patrick/CuratedData/Lipids/DOPC/"+\
            "NegativeControls/Representative_Gallery/"
    _,raw_data = FEC_Util.read_and_cache_pxp(base,force=False)
    processed = [FEC_Util.SplitAndProcess(r) for r in raw_data]
    inches_per_plot = 4.5
    n_rows,n_cols = FEC_Plot._n_rows_and_cols(processed)
    fig_size = (n_cols*inches_per_plot,n_rows*inches_per_plot)
    fig = PlotUtilities.figure(figsize=(fig_size))
    ylim_pN = [-20,75]
    xlim_nm = [-10,100]
    FEC_Plot.gallery_fec(processed,xlim_nm,ylim_pN)
    plt.suptitle("Negative Control Gallery",y=1.2,fontsize=25)
    PlotUtilities.savefig(fig,base + "out.png",close=False)
    PlotUtilities.savefig(fig,"./out.png")
开发者ID:prheenan,项目名称:Research,代码行数:27,代码来源:main_negative_gallery.py

示例2: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run():
    BaseDir = "/Volumes/group/4Patrick/Reports/" + \
           "2016_6_5_NearEquilibrium_Biotin_DOPC/IWT/"
    InBase = BaseDir + "In/"
    OutBase = BaseDir + "Out/"
    FullNames = [
    InBase +"2016-6-3-micah-1-part-per-million-biolevel-long-strept-coated.pxp",
    InBase +"2016-6-4-micah-1ppm-biolever-long-strept-saved-data.pxp",
    InBase +"2016-6-5-micah-1ppm-biolever-long-strept-saved-data.pxp"
    ]
    Limit = 100
    ForceReRead = False
    ForceRePlot = False
    IwtObjects,RetractList,Touchoff,LandscapeObj  = \
            CheckpointUtilities.getCheckpoint(OutBase + "IWT.pkl",
                                              IWT_Util.GetObjectsAndIWT,
                                              ForceReRead,InBase,FullNames,
                                              ForceReRead,
                                              Limit=Limit)
    ext,force  = CheckpointUtilities.\
        getCheckpoint(OutBase + "ExtAndForce.pkl",
                      IWT_Util.GetAllExtensionsAndForceAndPlot,
                      ForceRePlot,RetractList,
                      Touchoff,IwtObjects,OutBase)
    fig = PlotUtilities.figure(figsize=(8,12))
    IWT_Util.ForceExtensionHistograms(force,ext)
    PlotUtilities.savefig(fig,OutBase + "HeatMap.png")
    fig = PlotUtilities.figure(figsize=(8,12))
    IWT_Util.EnergyLandscapePlot(LandscapeObj)
    PlotUtilities.savefig(fig,OutBase + "IWT.png")
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:IWT_Main.py

示例3: sequence_plots

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def sequence_plots(out_base,*args,**kwargs):
    break_points = [_break_after_interp,_break_after_first_zoom,_dont_break]
    for i,break_point in enumerate(break_points):
        fig = PlotUtilities.figure((8,9))
        plot(*args,when_to_break=break_point,**kwargs)
        PlotUtilities.savefig(fig,out_base + "{:d}.pdf".format(i),
                              subplots_adjust=dict(wspace=0.05))
开发者ID:prheenan,项目名称:Research,代码行数:9,代码来源:main_figure_noise.py

示例4: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run(base="./"):
    """
    
    """
    out_base = base
    data_base =  base + "data/"
    data_file = "../FigurePerformance_CS/data/Scores.pkl"
    force=False
    cache_file = base + "cache.pkl"
    fec_file = data_base + "multiple.csv.pkl"
    name = "FEATHER"
    final_out_hist = "{:s}{:s}_distances.pdf".format(out_base,
                                                     name.replace(" ","_"))
    l = CheckpointUtilities.getCheckpoint(cache_file,get_feather_run,force,
                                          data_file)
    # make the distance histogram figure for the presenation
    fig = PlotUtilities.figure((10,5))
    make_distance_figure(l,data_file,fec_file)
    PlotUtilities.legend(loc='upper right')
    PlotUtilities.savefig(fig,final_out_hist.replace(".pdf","_pres.pdf"))
    # make the distance histogram figure
    fig = PlotUtilities.figure((16,6))
    make_distance_figure(l,data_file,fec_file)
    PlotUtilities.legend(loc='upper right')
    PlotUtilities.label_tom(fig,loc=(-0.1,1.0),fontsize=18)
    PlotUtilities.savefig(fig,final_out_hist)
开发者ID:prheenan,项目名称:Research,代码行数:28,代码来源:main_figure_performance_cs_distance.py

示例5: ScatterPlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def ScatterPlot(TransitionForces,ListOfSepAndFits,ExpectedContourLength,
                OutDir):
    """
    Makes a scatter plot of the contour length and transition forces

    Args:
        TransitionForces: array, each element the transition region for curve i
        ListOfSepAndFits: array, each element the output of GetWLCFits
        ExpectedContourLength: how long we expect the construct to be
        OutDir: base directory, for saving stuff
    """
    L0Arr = []
    TxArr = []
    for (SepNear,FitObj),TransitionFoces in zip(ListOfSepAndFits,
                                                TransitionForces):
        MedianTx = np.median(TransitionFoces)
        L0,Lp,_,_ = FitObj.Params()
        L0Arr.append(L0)
        TxArr.append(MedianTx)
    # go ahead an throw out ridiculous data from the WLC, where transition
    # normalize the contour length to L0
    L0Arr = np.array(L0Arr)/ExpectedContourLength
    # convert to useful units
    L0Plot = np.array(L0Arr)
    TxPlot =  np.array(TxArr) * 1e12
    fig = pPlotUtil.figure(figsize=(12,12))
    plt.subplot(2,2,1)
    plt.plot(L0Plot,TxPlot,'go',label="Data")
    alpha = 0.3
    ColorForce = 'r'
    ColorLength = 'b'
    plt.axhspan(62,68,color=ColorForce,label=r"$F_{\rm tx}$ $\pm$ 5%",
                alpha=alpha)
    L0BoxMin = 0.9
    L0BoxMax = 1.1
    plt.axvspan(L0BoxMin,L0BoxMax,color=ColorLength,
                label=r"L$_{\rm 0}$ $\pm$ 10%",alpha=alpha)
    fudge = 1.05
    # make the plot boundaries OK
    MaxX = max(L0BoxMax,max(L0Plot))*fudge
    MaxY = 90
    plt.xlim([0,MaxX])
    plt.ylim([0,MaxY])
    pPlotUtil.lazyLabel("",r"F$_{\rm overstretch}$ (pN)",
                        "DNA Characterization Histograms ",frameon=True)
    ## now make 1-D histograms of everything
    # subplot of histogram of transition force
    HistOpts = dict(alpha=alpha,linewidth=0)
    plt.subplot(2,2,2)
    TransitionForceBins = np.linspace(0,MaxY)
    plt.hist(TxPlot,bins=TransitionForceBins,orientation="horizontal",
             color=ColorForce,**HistOpts)
    pPlotUtil.lazyLabel("Count","","")
    plt.ylim([0,MaxY])
    plt.subplot(2,2,3)
    ContourBins = np.linspace(0,MaxX)
    plt.hist(L0Plot,bins=ContourBins,color=ColorLength,**HistOpts)
    pPlotUtil.lazyLabel(r"$\frac{L_{\rm WLC}}{L_0}$","Count","")
    plt.xlim([0,MaxX])
    pPlotUtil.savefig(fig,"{:s}Out/ScatterL0vsFTx.png".format(OutDir))
开发者ID:prheenan,项目名称:Research,代码行数:62,代码来源:MainCorrection.py

示例6: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run(base="./"):
    """
    
    """
    name = "cartoon.pdf"
    data_base = base + "data/"
    file_names = ["no","single","multiple"]
    # save without the labels for the presentation
    subplots_adjust = dict(left=0.12,wspace=0.2,hspace=0.1)
    fig = PlotUtilities.figure((8,4))
    plot_fec_cartoon(base,data_base,file_names,
                     arrow_kwargs=dict(markersize=75))
    PlotUtilities.savefig(fig,name.replace(".pdf","_pres.pdf"),
                          subplots_adjust=subplots_adjust)
    # save with the labels for the presentation
    fig = PlotUtilities.figure((16,8))
    subplots_adjust = dict(left=0.08,wspace=0.2,hspace=0.1)
    plot_fec_cartoon(base,data_base,file_names,
                     arrow_kwargs=dict(markersize=125))
    n_subplots = 2
    n_categories = len(file_names)
    letters =  string.uppercase[:n_categories]
    letters = ([r"{:s}".format(s) for s in letters] + \
               ["" for _ in range(n_categories)])
    bottom = (-0.25,1)
    top = (-0.60,1)
    loc = [top for i in range(n_categories)] +  \
          [bottom for i in range(n_categories)] 
    PlotUtilities.label_tom(fig,letters,loc=loc)
    PlotUtilities.savefig(fig,name,subplots_adjust=subplots_adjust)
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:main_figure_cartoon.py

示例7: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    file_name = "defl.ibw"
    defl_volts_wave = PxpLoader.read_ibw_as_wave(file_name)
    defl_volts = defl_volts_wave.DataY
    invols_nm_per_volt = 154.8
    spring_pN_per_nM = 5.70
    force_pN = defl_volts * invols_nm_per_volt * spring_pN_per_nM
    # zero out to the maximum
    force_pN -= np.mean(force_pN)
    data_interval_in_s = 1/500e3
    rate = 1/float(data_interval_in_s) # data rate in Hz
    taus = np.logspace(-5,2,num=50,base=10) #  tau-values in seconds
    # fractional frequency data
    (taus_used, adev, adeverror, adev_n) = \
        allantools.adev(force_pN, data_type='freq', rate=rate, taus=taus)
    fig = PlotUtilities.figure()
    plt.errorbar(x=taus_used,y=adev,yerr=2*adeverror,label="95% C.I.")
    plt.xscale('log')
    plt.yscale('log')
    plt.axhline(1,color='r',linestyle='--',label="1 pN")
    PlotUtilities.lazyLabel("Averaging time (s)","Force (pN)","")
    PlotUtilities.savefig(fig,"out.png")
开发者ID:prheenan,项目名称:Research,代码行数:33,代码来源:main_allan.py

示例8: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    in_dir = "./data/"
    cache_dir = "./cache/"
    out_dir = in_dir
    GenUtilities.ensureDirExists(out_dir)
    images = ImageUtil.cache_images_in_directory(pxp_dir=in_dir,
                                                 cache_dir=cache_dir)
    # note: vmin/vmax are in nm (as is height)                                                  
    vmin_nm = 0
    vmax_nm = vmin_nm + 0.6
    imshow_kwargs = dict(vmin=vmin_nm,vmax=vmax_nm,cmap = plt.cm.Greys_r)    
    for im in images:
        src_file = im.SourceFilename()
        # path to save the image out 
        full_out_path = "{:s}{:s}-{:s}.png".format(out_dir,src_file,im.Name())        
        fig = PlotUtilities.figure((3.5,4))
        ax = plt.subplot(1,1,1)
        im.height = ImageUtil.subtract_background(im,deg=3)
        im = ImageUtil.make_image_plot(im,imshow_kwargs,pct=50)
        ImageUtil.smart_colorbar(im=im,ax=ax,fig=fig)
        PlotUtilities.savefig(fig,full_out_path,bbox_inches='tight')        
开发者ID:prheenan,项目名称:Research,代码行数:32,代码来源:main_process_2017-8-15.py

示例9: InTheWeedsPlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def InTheWeedsPlot(OutBase,UnfoldObj,RefoldObj=[],Example=None,
                   Bins=[50,75,100,150,200,500,1000],**kwargs):
    """
    Plots a detailed energy landscape, and saves

    Args:
        OutBase: where to start the save
        UnfoldObj: unfolding objects
        RefoldObj: refolding objects
        Bins: how many bins to use in the energy landscape plots
        <min/max>_landscape_kT: bounds on the landscape
    Returns:
        nothing
    """
    # get the IWT
    kT = 4.1e-21
    for b in Bins:
        LandscapeObj =  InverseWeierstrass.\
            FreeEnergyAtZeroForce(UnfoldObj,NumBins=b,RefoldingObjs=RefoldObj)
        # make a 2-D histogram of everything
        if (Example is not None):
            fig = PlotUtilities.figure(figsize=(8,8))
            ext_nm = Example.Separation*1e9
            IWT_Util.ForceExtensionHistograms(ext_nm,
                                              Example.Force*1e12,
                                              AddAverage=False,
                                              nBins=b)
            PlotUtilities.savefig(fig,OutBase + "0_{:d}hist.pdf".format(b))
        # get the distance to the transition state etc
        print("DeltaG_Dagger is {:.1f}kT".format(Obj.DeltaGDagger))
        fig = PlotUtilities.figure(figsize=(12,12))
        plot_single_landscape(LandscapeObj,add_meta_half=True,
                              add_meta_free=True,**kwargs)
        PlotUtilities.savefig(fig,OutBase + "1_{:d}IWT.pdf".format(b))
开发者ID:prheenan,项目名称:Research,代码行数:36,代码来源:IWT_Plot.py

示例10: SavePlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def SavePlot(SortByZ,FullName,SaveName):
    Objs = FEC_Util.ReadInData(FullName)
    Tmp = Objs[0]
    if (SortByZ):
        ArgSort = np.argsort(Tmp.Zsnsr)
        Tmp.Zsnsr = Tmp.Zsnsr[ArgSort]
        Tmp.Force = Tmp.Force[ArgSort]
        Offset = 150
    else:
        Offset = 0
    # set up the y limits in pN
    ylim = [Offset-20,Offset+25]
    fig = pPlotUtil.figure()
    plt.subplot(2,1,1)
    FullPlot(Tmp)
    pPlotUtil.lazyLabel("Stage position (nm)","Force (pN)","Flickering for FEC",
                        frameon=True)
    # x limits for 'zoomed in'
    plt.xlim([30,40])
    plt.ylim(ylim)
    plt.subplot(2,1,2)
    FullPlot(Tmp)
    pPlotUtil.lazyLabel("Stage position (nm)","Force (pN)","",frameon=True)
    # x limits for 'zoomed in'
    plt.xlim([36,36.5])
    plt.ylim(ylim)
    pPlotUtil.savefig(fig,SaveName)
开发者ID:prheenan,项目名称:Research,代码行数:29,代码来源:Main_6_7_flickering_example.py

示例11: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run():
    """
    simple script to compare wavelet transform and fft on something that
    looks like our data
    """             
    fig = PlotUtilities.figure(figsize=(10,16))
    MakeFigure()
    PlotUtilities.savefig(fig,"out.png")
开发者ID:prheenan,项目名称:Research,代码行数:10,代码来源:main_fft_vs_wt.py

示例12: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run():
    """
    Describes why we are picking the fluorophores we are
    """
    # get the excitation filter
    filter_file = "lumencor_631_28_nm.txt"
    arr = np.loadtxt(filter_file,skiprows=1)
    wavelength,filter_value = arr[:,0],arr[:,1]
    # convert from 0 to 1 transmission (from 0 to 100)
    filter_value /= 100
    # get the fluorophore
    # (see: http://www.fluorophores.tugraz.at/substance/418)
    fluorophore_file = "atto_5382.csv"
    arr = np.loadtxt(fluorophore_file,skiprows=1,delimiter=";",
                     usecols=(0,1,2,3))
    wavelength_fluorophore_excitation_nm,excitation = arr[:,0],arr[:,1]
    wavelength_fluorophore_emission_nm,emission = arr[:,2],arr[:,3]
    # get the emission filter 
    # see: laser2000.co.uk/semrock_filter.php?code=FF01-680/42-25
    emission_filter_file = "FF01-680_42.txt"
    arr_emit = np.loadtxt(emission_filter_file,skiprows=4)
    wavelength_emission_filter,emission_filter = arr_emit[:,0],arr_emit[:,1]
    # plot the fluorophores
    label_excite_emit = "\n({:s})".format(fluorophore_file)
    wavelength_limits_nm = [500,800]
    fig = PlotUtilities.figure((5,6))
    plt.subplot(2,1,1)
    plt.plot(wavelength,filter_value,
             label=("Filter (excitation)\n" +  filter_file))
    plt.plot(wavelength_fluorophore_excitation_nm,excitation,
             label="Fluorophore Excitation" + label_excite_emit,
             linestyle='--')
    PlotUtilities.lazyLabel("","Excitation efficiency","")
    plt.xlim(wavelength_limits_nm)
    PlotUtilities.no_x_label()
    plt.subplot(2,1,2)
    plt.plot(wavelength_emission_filter,emission_filter,
             label="Filter (emission) \n" + emission_filter_file)
    plt.plot(wavelength_fluorophore_emission_nm,emission,
             label="Flurophore Emission" + label_excite_emit,
             linestyle='--')
    plt.xlim(wavelength_limits_nm)
    PlotUtilities.lazyLabel("Wavelength (nm)","Emission efficiency","")
    PlotUtilities.savefig(fig,"./filter_comparisons.png")
    p1607F,_ = CommonPrimerUtil.Get1607FAnd3520R("../..")
    # add a dbco and a fluorophore...
    seq_full = [IdtUtil.Dbco5Prime()] + [s for s in p1607F] + \
               [IdtUtil.atto_633()]
    # get the IDT order
    opts = dict(Scale=IdtUtil.Scales._100NM,
                Purification=IdtUtil.Purifications.HPLC)
    order = IdtUtil.\
            SequencesAndNamesTuplesToOrder( [(seq_full,"AzideTestFluorophore")],
                                            **opts)
    IdtUtil.PrintAndSave(order,"./test_azide_fluorophore.txt")
开发者ID:prheenan,项目名称:Research,代码行数:57,代码来源:main_fluorescent_primers.py

示例13: run

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

    Args:
        param1: This is the first param.
    
    Returns:
        This is a description of what is returned.
    """
    Base = "./"
    OutBase = Base + "out/"
    InFiles = [Base + "PatrickIsGreedy.pxp"]
    RawData = IWT_Util.\
              ReadInAllFiles(InFiles,Limit=50,
                             ValidFunc=PxpLoader.valid_fec_allow_endings)
    # get the start/ends of the re-folding and unfolding portions
    # hard coded constant for now...
    # XXX for re-folding, need to add in schedule
    # XXX ensure properly zeroed?
    idx_end_of_unfolding = int(16100/2)
    IwtData,IwtData_fold = split(RawData,idx_end_of_unfolding)
    # get the titled landscape...
    all_landscape = [-np.inf,np.inf]
    Bounds = IWT_Util.BoundsObj(bounds_folded_nm= all_landscape,
                                bounds_transition_nm= all_landscape,
                                bounds_unfolded_nm=all_landscape,
                                force_one_half_N=15e-12)
    OutBase = "./out/"
    # get the unfolding histograms
    forces_unfold = np.concatenate([r.Force for r in IwtData])
    separations_unfold = np.concatenate([r.Extension for r in IwtData])
    # get the folding histograms..
    forces_fold = np.concatenate([r.Force for r in IwtData_fold])
    separations_fold = np.concatenate([r.Extension for r in IwtData_fold])
    # zero everything...
    n_bins = 80
    fig = PlotUtilities.figure(figsize=(12,16))
    kwargs_histogram = dict(AddAverage=False,nBins=n_bins)
    plt.subplot(2,1,1)
    IWT_Util.ForceExtensionHistograms(separations_unfold*1e9,
                                      forces_unfold*1e12,**kwargs_histogram)
    PlotUtilities.xlabel("")
    PlotUtilities.title("*Unfolding* 2-D histogram")
    plt.subplot(2,1,2)
    IWT_Util.ForceExtensionHistograms(separations_fold*1e9,
                                      forces_fold*1e12,**kwargs_histogram)
    PlotUtilities.title("*Folding* 2-D histogram")
    PlotUtilities.savefig(fig,OutBase + "0_{:d}hist.pdf".format(n_bins))
    IWT_Plot.InTheWeedsPlot(OutBase=OutBase,
                            UnfoldObj=IwtData,
                            bounds=Bounds,Bins=[40,60,80,120,200],
                            max_landscape_kT=None,
                            min_landscape_kT=None)
开发者ID:prheenan,项目名称:Research,代码行数:56,代码来源:Main_alpha3d_iwt.py

示例14: run

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def run():
    """
    Generates FRET histograms from NaCl and KCl data
    """
    data = ReadNaCl("./Data/NaCl")
    dataKcl = ReadKCl("./Data/KCl")
    # assume number of histograms is the same
    NumHists = len(data)
    fig = pPlotUtil.figure(figsize=(12,16))
    CommonStyle = dict(alpha=0.3,linewidth=0)
    StyleDicts = [dict(color='m',label="0mM NaCl",**CommonStyle),
                  dict(color='r',label="1mM NaCl",**CommonStyle),
                  dict(color='k',label="10mM NaCl",**CommonStyle),
                  dict(color='c',label="25mM NaCl",**CommonStyle),
                  dict(color='g',label="50mM NaCl",**CommonStyle),
                  dict(color='b',label="100mM NaCl",**CommonStyle)]
    # for style, just replace label 'NaCl' with 'KCL'
    StyleDictKCL = copy.deepcopy(StyleDicts)
    for i,TmpDict in enumerate(StyleDictKCL):
        TmpDict['label'] = TmpDict['label'].replace("NaCl","KCl")
        TmpDict['alpha'] = 0.7
        TmpDict['linewidth'] = 0.5
    # determine the bounds for the FRET
    MinFret = -0.25
    MaxFretFromData = np.max([max(arr) for arr in data])
    MaxFret = 1.2
    # assume a-priori knowledge of the bin counts
    MinBin = 0
    MaxBin = 140
    StepFret = 0.01
    ylim = [MinBin,MaxBin]
    bins = np.arange(MinFret,MaxFret,StepFret)
    for i,histogram in enumerate(data):
        title = "High salt induces GQ folding" \
                if i == 0 else ""
        # plot the NaCl data
        plt.subplot(NumHists,2,(2*i+1))
        plt.hist(histogram,bins=bins,**StyleDicts[i])
        AxesDefault(ylim,title,"Count",UseYTicks=True)
        plt.subplot(NumHists,2,2*(i+1))
        plt.hist(dataKcl[i],bins=bins,**StyleDictKCL[i])
        AxesDefault(ylim,"","",UseYTicks=False)
        # plot the KCl Data
    plt.subplot(NumHists,2,11)
    ax = plt.gca()
    plt.setp(ax.get_xticklabels(),visible=True)
    plt.setp(ax.get_yticklabels(),visible=True)
    pPlotUtil.lazyLabel("FRET","Count","",frameon=True)
    plt.subplot(NumHists,2,12)
    ax = plt.gca()
    plt.setp(ax.get_xticklabels(),visible=True)
    pPlotUtil.lazyLabel("FRET","","",frameon=True)

    pPlotUtil.savefig(fig,"./out.png")
开发者ID:prheenan,项目名称:Research,代码行数:56,代码来源:MainHistogramAnalysis.py

示例15: TomPlot

# 需要导入模块: from GeneralUtil.python import PlotUtilities [as 别名]
# 或者: from GeneralUtil.python.PlotUtilities import savefig [as 别名]
def TomPlot(LandscapeObj,OutBase,UnfoldObj,RefoldObj,idx,f_one_half_N=0e-12):
    # get a forward and reverse
    ToX = lambda x: x * 1e9
    ToForceY = lambda y: y * 1e12
    fig = PlotUtilities.figure(figsize=(8,4))
    plt.subplot(1,2,1)
    SubplotArgs = dict(alpha=0.4,linewidth=0.5)
    FilterN = 500
    Unfold = FEC_Util.GetFilteredForce(UnfoldObj[idx],FilterN)
    Refold = FEC_Util.GetFilteredForce(RefoldObj[idx],FilterN)
    UnfoldX = ToX(Unfold.Extension)
    UnfoldY = ToForceY(Unfold.Force)
    FoldX = ToX(Refold.Extension)
    FoldY = ToForceY(Refold.Force)
    plt.plot(UnfoldX,UnfoldY,color='r',label="Unfolding",
             **SubplotArgs)
    plt.plot(FoldX,FoldY,color='b',label="Refolding",
             **SubplotArgs)
    fontdict = dict(fontsize=13)
    x_text_dict =  dict(x=60, y=22.5, s="2 nm", fontdict=fontdict,
                        withdash=False,
                        rotation="horizontal")
    y_text_dict =  dict(x=59, y=27, s="5 pN", fontdict=fontdict, withdash=False,
                        rotation="vertical")
    PlotUtilities.ScaleBar(x_kwargs=dict(x=[60,62],y=[24,24]),
                           y_kwargs=dict(x=[60,60],y=[25,30]),
                           text_x=x_text_dict,text_y=y_text_dict)
    PlotUtilities.legend(loc=[0.4,0.8],**fontdict)
    plt.subplot(1,2,2)
    Obj =  IWT_Util.TiltedLandscape(LandscapeObj,f_one_half_N=f_one_half_N)
    plt.plot(Obj.landscape_ext_nm,Obj.OffsetTilted_kT)
    plt.xlim([56,69])
    plt.ylim([-1,4])
    yoffset = 1
    x_text_dict =  dict(x=58.5, y=yoffset+1.5, s="2 nm", fontdict=fontdict,
                        withdash=False,rotation="horizontal")
    y_text_dict =  dict(x=57, y=yoffset+2.5, s=r"1 k$_\mathrm{b}$T",
                        fontdict=fontdict, withdash=False,
                        rotation="vertical")
    PlotUtilities.ScaleBar(x_kwargs=dict(x=[58,60],
                                         y=[yoffset+1.75,yoffset+1.75]),
                           y_kwargs=dict(x=[58,58],y=[yoffset+2,yoffset+3]),
                           text_x=x_text_dict,text_y=y_text_dict,
                           kill_axis=True)
    PlotUtilities.savefig(fig,OutBase + "TomMockup" + str(idx) + ".png",
                          subplots_adjust=dict(bottom=-0.1))
    # save out the data exactly as we want to plot it
    common = dict(delimiter=",")
    ext = str(idx) + ".txt"
    np.savetxt(X=np.c_[UnfoldX,UnfoldY],fname=OutBase+"Unfold" + ext,**common)
    np.savetxt(X=np.c_[FoldX,FoldY],fname=OutBase+"Fold"+ext,**common)
    np.savetxt(X=np.c_[Obj.landscape_ext_nm,Obj.OffsetTilted_kT],
               fname=OutBase+"Landscape"+ext,**common)
开发者ID:prheenan,项目名称:Research,代码行数:55,代码来源:IWT_Plot.py


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