Changeset 2881


Ignore:
Timestamp:
Jun 27, 2017 4:55:15 PM (4 years ago)
Author:
toby
Message:

Set tickmark colors for phases the same for all powder histograms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r2879 r2881  
    18401840        Page.canvas.mpl_connect('button_press_event',OnPress)
    18411841    if 'PWDR' in G2frame.PatternTree.GetItemText(G2frame.PickId):
     1842        Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
     1843        refColors=['b','r','c','g','m','k']
     1844        Page.phaseColors = {p:refColors[i%len(refColors)] for i,p in enumerate(Phases)}
    18421845        Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Reflection Lists'))
    18431846        Page.phaseList = sorted(Phases.keys()) # define an order for phases (once!)
     
    22312234        elif G2frame.PatternTree.GetItemText(PickId) in ['Reflection Lists'] or \
    22322235            'PWDR' in G2frame.PatternTree.GetItemText(PickId):
    2233             refColors=['b','r','c','g','m','k']
    22342236            Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists'))
    22352237            l = GSASIIpath.GetConfigValue('Tick_length',8.0)
     
    22462248                    peak = np.array([[peak[4],peak[5]] for peak in peaks])
    22472249                pos = Pattern[0]['refOffset']-pId*Pattern[0]['refDelt']*np.ones_like(peak)
     2250                plsym = Page.phaseColors.get(phase,'y')+'|' # yellow should never happen!
    22482251                if G2frame.plotStyle['qPlot']:
    2249                     Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)
     2252                    Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase)
    22502253                elif G2frame.plotStyle['dPlot']:
    2251                     Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)
     2254                    Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase)
    22522255                else:
    2253                     Page.tickDict[phase],j = Plot.plot(peak.T[1],pos,refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)
     2256                    Page.tickDict[phase],j = Plot.plot(peak.T[1],pos,plsym,mew=w,ms=l,picker=3.,label=phase)
    22542257            if len(Phases):
    22552258                handles,legends = Plot.get_legend_handles_labels()  #got double entries in the legends for some reason
Note: See TracChangeset for help on using the changeset viewer.