Changeset 3388 for trunk/GSASIIplot.py


Ignore:
Timestamp:
May 15, 2018 12:24:54 PM (4 years ago)
Author:
vondreele
Message:

added Plot Colors to configuration to allow user color selection for line plots
mask plots by limits (unless Limits selected)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3384 r3388  
    24132413    PickId = G2frame.PickId
    24142414    PatternId = G2frame.PatternId
    2415     colors=['b','g','r','c','m','k']
     2415    try:
     2416        colors = GSASIIpath.GetConfigValue('Plot_Colors').split()
     2417        for color in colors:
     2418            if color not in ['k','r','g','b','m','c']:
     2419                print('**** bad color code: '+str(color)+' - redo Preferences/Plot Colors ****')
     2420                raise Exception
     2421    except:
     2422        colors = ['b','g','r','c','m','k']
    24162423    Lines = []
    24172424    exclLines = []
    24182425    if G2frame.SinglePlot and PatternId:
    2419         Pattern = G2frame.GPXtree.GetItemPyData(PatternId)
     2426        Pattern = copy.deepcopy(G2frame.GPXtree.GetItemPyData(PatternId))
    24202427        Pattern.append(G2frame.GPXtree.GetItemText(PatternId))
    24212428        PlotList = [Pattern,]
     
    24432450        for item in choices:
    24442451            id = G2gd.GetGPXtreeItemId(G2frame,G2frame.root, item)
    2445             Pattern = G2frame.GPXtree.GetItemPyData(id)
     2452            Pattern = copy.deepcopy(G2frame.GPXtree.GetItemPyData(id))
    24462453            if len(Pattern) < 3:                    # put name on end if needed
    24472454                Pattern.append(G2frame.GPXtree.GetItemText(id))
     
    25462553            xye0 = ma.array(xye0,mask=False)
    25472554#            xye0.mask = False # resets mask for xye0 & Pattern[1][0](!)
     2555            xye0 = ma.masked_outside(xye0,limits[1][0],limits[1][1])
    25482556            for excl in excls:
    25492557                xye0 = ma.masked_inside(xye0,excl[0],excl[1]) # sets mask on xye0 but not Pattern[1][0] !
     
    26612669                DX = xlim[1]-xlim[0]
    26622670                X += 0.002*offsetX*DX*N
    2663             Xum = ma.getdata(X) # unmasked version of X, use to plot data (only)
     2671            if G2frame.GPXtree.GetItemText(PickId) == 'Limits':
     2672                Xum = ma.getdata(X) # unmasked version of X, use for data limits (only)
     2673            else:
     2674                Xum = X[:]
     2675            Ibeg = np.searchsorted(X,limits[1][0])
     2676            Ifin = np.searchsorted(X,limits[1][1])
    26642677            if ifpicked:
    26652678                if Page.plotStyle['sqrtPlot']:
     
    27052718                        Plot.set_ylim(bottom=np.min(np.trim_zeros(YB))/2.,top=np.max(Y)*2.)
    27062719                if G2frame.Weight:
    2707                     Ibeg = np.searchsorted(X,limits[1][0])
    2708                     Ifin = np.searchsorted(X,limits[1][1])
    27092720                    Plot1.set_yscale("linear")                                                 
    27102721                    wtFactor = Pattern[0]['wtFactor']
     
    27212732                    elif plottype in ['SASD','REFD']:
    27222733                        Plot.set_xscale("log",nonposx='mask')
    2723                         Ibeg = np.searchsorted(X,limits[1][0])
    2724                         Ifin = np.searchsorted(X,limits[1][1])
    27252734                        Plot.set_yscale("log",nonposy='mask')
    27262735                        if G2frame.ErrorBars:
Note: See TracChangeset for help on using the changeset viewer.