Changeset 3364


Ignore:
Timestamp:
Apr 28, 2018 10:57:55 AM (6 years ago)
Author:
vondreele
Message:

remove plotStyle from G2frame & put it in Page so now there is a set for each G2PlotMpl Page
logPlot, sqrtPlot, sqPlot, dPlot & qPlot all in plotStyle

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3363 r3364  
    26682668        self.undofile = ''
    26692669        self.TreeItemDelete = False
    2670         self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False}
    26712670        self.Weight = False
    26722671        self.IfPlot = False
  • trunk/GSASIIplot.py

    r3362 r3364  
    391391        self.toolbar = GSASIItoolbar(self.canvas,publish=publish)
    392392        self.toolbar.Realize()
     393        self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False,'logPlot':False}
     394        self.logPlot = False
     395        self.sqrtPlot = False
    393396       
    394397        sizer=wx.BoxSizer(wx.VERTICAL)
     
    15931596       G2frame.HKL (used for tool tip display of hkl for selected phase reflection list)
    15941597    '''
    1595     global exclLines
     1598    global exclLines,Page
    15961599    global DifLine # BHT: probably does not need to be global
    15971600    global Ymax
     
    16201623            return
    16211624        newPlot = False
    1622         if event.key == 'w' and not G2frame.plotStyle['qPlot'] and not G2frame.plotStyle['dPlot']:  #can't do weight plots when x-axis is different
     1625        if event.key == 'w' and not Page.plotStyle['qPlot'] and not Page.plotStyle['dPlot']:  #can't do weight plots when x-axis is different
    16231626            G2frame.Weight = not G2frame.Weight
    16241627            if not G2frame.Weight and 'PWDR' in plottype:
     
    16351638                pass
    16361639            else:
    1637                 G2frame.logPlot = not G2frame.logPlot
    1638                 if not G2frame.logPlot:
     1640                Page.plotStyle['logPlot'] = not Page.plotStyle['logPlot']
     1641                if not Page.plotStyle['logPlot']:
    16391642                    Pattern[0]['Offset'][0] = 0
    16401643                newPlot = True
    16411644        elif event.key == 's' and 'PWDR' in plottype:
    16421645            if G2frame.SinglePlot:  #toggle sqrt plot
    1643                 G2frame.plotStyle['sqrtPlot'] = not G2frame.plotStyle['sqrtPlot']
     1646                Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot']
    16441647                Ymax = max(Pattern[1][1])
    1645                 if G2frame.plotStyle['sqrtPlot']:
     1648                if Page.plotStyle['sqrtPlot']:
    16461649                    Pattern[0]['delOffset'] = .002*np.sqrt(Ymax)
    16471650                    Pattern[0]['refOffset'] = -0.1*np.sqrt(Ymax)
     
    16981701            G2frame.Contour = not G2frame.Contour
    16991702            if G2frame.Contour:
    1700                 G2frame.plotStyle['qPlot'] = False
    1701                 G2frame.plotStyle['dPlot'] = False
     1703                Page.plotStyle['qPlot'] = False
     1704                Page.plotStyle['dPlot'] = False
    17021705        elif event.key == 'a' and 'PWDR' in plottype and G2frame.SinglePlot and not (
    1703                  G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     1706                 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    17041707            # add a magnification region
    17051708            try:
     
    17091712                    Pattern[0]['Magnification'] = []
    17101713                try:
    1711                     if G2frame.plotStyle['qPlot']:
     1714                    if Page.plotStyle['qPlot']:
    17121715                        xpos = G2lat.Dsp2pos(Parms,2.0*np.pi/xpos)
    1713                     elif G2frame.plotStyle['dPlot']:
     1716                    elif Page.plotStyle['dPlot']:
    17141717                        xpos = G2lat.Dsp2pos(Parms,xpos)
    17151718                except ValueError:
     
    17251728            newPlot = True
    17261729            if 'PWDR' in plottype:
    1727                 G2frame.plotStyle['qPlot'] = not G2frame.plotStyle['qPlot']
    1728                 if G2frame.plotStyle['qPlot']:
     1730                Page.plotStyle['qPlot'] = not Page.plotStyle['qPlot']
     1731                if Page.plotStyle['qPlot']:
    17291732                    G2frame.Weight = False
    17301733                    G2frame.Contour = False
    1731                 G2frame.plotStyle['dPlot'] = False
     1734                Page.plotStyle['dPlot'] = False
    17321735            elif plottype in ['SASD','REFD']:
    1733                 G2frame.plotStyle['sqPlot'] = not G2frame.plotStyle['sqPlot']
     1736                Page.plotStyle['sqPlot'] = not Page.plotStyle['sqPlot']
    17341737        elif event.key == 't' and 'PWDR' in plottype:
    1735             G2frame.plotStyle['dPlot'] = not G2frame.plotStyle['dPlot']
    1736             if G2frame.plotStyle['dPlot']:
     1738            Page.plotStyle['dPlot'] = not Page.plotStyle['dPlot']
     1739            if Page.plotStyle['dPlot']:
    17371740                G2frame.Contour = False               
    17381741                G2frame.Weight = False
    1739             G2frame.plotStyle['qPlot'] = False
     1742            Page.plotStyle['qPlot'] = False
    17401743            newPlot = True     
    17411744        elif event.key == 'm':
    1742             G2frame.plotStyle['sqrtPlot'] = False
     1745            Page.plotStyle['sqrtPlot'] = False
    17431746            G2frame.SinglePlot = not G2frame.SinglePlot               
    17441747            newPlot = True
     
    17871790            limx = Plot.get_xlim()
    17881791            dT = tolerance = np.fabs(limx[1]-limx[0])/100.
    1789             if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
     1792            if Page.plotStyle['qPlot'] and 'PWDR' in plottype:
    17901793                q = xpos
    17911794                if q <= 0:
     
    18091812                    return
    18101813                dsp = 2.*np.pi/q
    1811             elif G2frame.plotStyle['dPlot']:
     1814            elif Page.plotStyle['dPlot']:
    18121815                dsp = xpos
    18131816                if dsp <= 0:
     
    18361839                if 'C' in Parms['Type'][0]:
    18371840                    if 'PWDR' in plottype:
    1838                         if G2frame.plotStyle['sqrtPlot']:
     1841                        if Page.plotStyle['sqrtPlot']:
    18391842                            G2frame.G2plotNB.status.SetStatusText('2-theta =%9.3f d =%9.5f q = %9.5f sqrt(Intensity) =%9.2f'%(xpos,dsp,q,ypos),1)
    18401843                        else:
     
    18451848                        G2frame.G2plotNB.status.SetStatusText('q =%12.5g Reflectivity =%12.5g d =%9.1f'%(q,ypos,dsp),1)
    18461849                else:
    1847                     if G2frame.plotStyle['sqrtPlot']:
     1850                    if Page.plotStyle['sqrtPlot']:
    18481851                        G2frame.G2plotNB.status.SetStatusText('TOF =%9.3f d =%9.5f q =%9.5f sqrt(Intensity) =%9.2f'%(xpos,dsp,q,ypos),1)
    18491852                    else:
     
    19821985            Page.canvas.blit(Page.figure.gca().bbox)
    19831986
     1987        global Page
    19841988        try:
    19851989            Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters'))
     
    19992003            xy = list(list(zip(np.take(xpos,ind),np.take(ypos,ind)))[0])
    20002004            # convert from plot units
    2001             if G2frame.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
     2005            if Page.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
    20022006                xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0])
    2003             elif G2frame.plotStyle['dPlot']:                            #dplot - convert back to 2-theta
     2007            elif Page.plotStyle['dPlot']:                            #dplot - convert back to 2-theta
    20042008                xy[0] = G2lat.Dsp2pos(Parms,xy[0])
    2005             if G2frame.plotStyle['sqrtPlot']:
    2006                 xy[1] = xy[1]**2
     2009#            if Page.plotStyle['sqrtPlot']:
     2010#                xy[1] = xy[1]**2
    20072011        PatternId = G2frame.PatternId
    20082012        PickId = G2frame.PickId
     
    20292033                LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits')
    20302034                data = G2frame.GPXtree.GetItemPyData(LimitId)
    2031                 if G2frame.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
     2035                if Page.plotStyle['qPlot']:                              #qplot - convert back to 2-theta
    20322036                    xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0])
    2033                 elif G2frame.plotStyle['dPlot']:                            #dplot - convert back to 2-theta
     2037                elif Page.plotStyle['dPlot']:                            #dplot - convert back to 2-theta
    20342038                    xy[0] = G2lat.Dsp2pos(Parms,xy[0])
    20352039                if G2frame.ifGetExclude:
     
    21692173            xy = [event.xdata,event.ydata]
    21702174            try:
    2171                 if G2frame.plotStyle['qPlot']:                            #qplot - convert back to 2-theta
     2175                if Page.plotStyle['qPlot']:                            #qplot - convert back to 2-theta
    21722176                    xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0])
    2173                 elif G2frame.plotStyle['dPlot']:                          #dplot - convert back to 2-theta
     2177                elif Page.plotStyle['dPlot']:                          #dplot - convert back to 2-theta
    21742178                    xy[0] = G2lat.Dsp2pos(Parms,xy[0])
    21752179            except:
    21762180                return
    2177             if G2frame.plotStyle['sqrtPlot']:
     2181            if Page.plotStyle['sqrtPlot']:
    21782182                xy[1] = xy[1]**2
    21792183            backPts = G2frame.dataWindow.wxID_BackPts
     
    22072211            xpos = event.xdata
    22082212            try:
    2209                 if G2frame.plotStyle['qPlot']:                            #qplot - convert back to 2-theta
     2213                if Page.plotStyle['qPlot']:                            #qplot - convert back to 2-theta
    22102214                    xpos = G2lat.Dsp2pos(Parms,2*np.pi/xpos)
    2211                 elif G2frame.plotStyle['dPlot']:                          #dplot - convert back to 2-theta
     2215                elif Page.plotStyle['dPlot']:                          #dplot - convert back to 2-theta
    22122216                    xpos = G2lat.Dsp2pos(Parms,xpos)
    22132217            except:
     
    22342238                id = lineNo//2+1
    22352239                id2 = lineNo%2
    2236                 if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
     2240                if Page.plotStyle['qPlot'] and 'PWDR' in plottype:
    22372241                    limits[id][id2] = G2lat.Dsp2pos(Parms,2.*np.pi/xpos)
    2238                 elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:
     2242                elif Page.plotStyle['dPlot'] and 'PWDR' in plottype:
    22392243                    limits[id][id2] = G2lat.Dsp2pos(Parms,xpos)
    22402244                else:
     
    22522256                    del peaks['peaks'][lineNo-2-nxcl]
    22532257                else:
    2254                     if G2frame.plotStyle['qPlot']:
     2258                    if Page.plotStyle['qPlot']:
    22552259                        peaks['peaks'][lineNo-2-nxcl][0] = G2lat.Dsp2pos(Parms,2.*np.pi/xpos)
    2256                     elif G2frame.plotStyle['dPlot']:
     2260                    elif Page.plotStyle['dPlot']:
    22572261                        peaks['peaks'][lineNo-2-nxcl][0] = G2lat.Dsp2pos(Parms,xpos)
    22582262                    else:
     
    22992303            if msg: msg += '\n'
    23002304            msg += " * only when a single histogram is plotted"
    2301         if G2frame.logPlot or G2frame.plotStyle['sqrtPlot']:
     2305        if Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot']:
    23022306            if msg: msg += '\n'
    23032307            msg += " * only when the intensity scale is linear (not log or sqrt)"
     
    23232327    else:
    23242328        if plottype in ['SASD','REFD']:
    2325             G2frame.logPlot = True
     2329            Page.plotStyle['logPlot'] = True
    23262330            G2frame.ErrorBars = True
    23272331        newPlot = True
     
    23612365            'i: interpolation method','s: color scheme','c: contour off')
    23622366    else:
    2363         if G2frame.logPlot:
     2367        if Page.plotStyle['logPlot']:
    23642368            if 'PWDR' in plottype:
    23652369                if G2frame.SinglePlot:
     
    24002404                        'q: toggle S(q) plot','m: toggle multidata plot','w: toggle (Io-Ic)/sig plot','+: no selection')
    24012405    if 'PWDR' in plottype and G2frame.SinglePlot and not (
    2402                 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     2406                Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    24032407        Page.Choice = Page.Choice + ('a: add magnification region',)
    24042408    magLineList = [] # null value indicates no magnification
     
    24682472    offsetX = Pattern[0]['Offset'][1]
    24692473    offsetY = Pattern[0]['Offset'][0]
    2470     if G2frame.logPlot:
     2474    if Page.plotStyle['logPlot']:
    24712475        Title = 'log('+Title+')'
    2472     if G2frame.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour:
     2476    if Page.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour:
    24732477        xLabel = r'$Q, \AA^{-1}$'
    2474     elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour:
     2478    elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour:
    24752479        xLabel = r'$d, \AA$'
    24762480    else:
     
    24972501    if 'C' in ParmList[0]['Type'][0]:
    24982502        if 'PWDR' in plottype:
    2499             if G2frame.plotStyle['sqrtPlot']:
     2503            if Page.plotStyle['sqrtPlot']:
    25002504                Plot.set_ylabel(r'$\sqrt{Intensity}$',fontsize=16)
    25012505            else:
    25022506                Plot.set_ylabel(r'$Intensity$',fontsize=16)
    25032507        elif plottype == 'SASD':
    2504             if G2frame.plotStyle['sqPlot']:
     2508            if Page.plotStyle['sqPlot']:
    25052509                Plot.set_ylabel(r'$S(Q)=I*Q^{4}$',fontsize=16)
    25062510            else:
    25072511                Plot.set_ylabel(r'$Intensity,\ cm^{-1}$',fontsize=16)
    25082512        elif plottype == 'REFD':
    2509             if G2frame.plotStyle['sqPlot']:
     2513            if Page.plotStyle['sqPlot']:
    25102514                Plot.set_ylabel(r'$S(Q)=R*Q^{4}$',fontsize=16)
    25112515            else:
    25122516                Plot.set_ylabel(r'$Reflectivity$',fontsize=16)               
    25132517    else:       #neutron TOF
    2514         if G2frame.plotStyle['sqrtPlot']:
     2518        if Page.plotStyle['sqrtPlot']:
    25152519            Plot.set_ylabel(r'$\sqrt{Normalized\ intensity}$',fontsize=16)
    25162520        else:
     
    25452549            Pattern[1][0] = ma.array(Pattern[1][0],mask=ma.getmask(xye0))
    25462550#            Pattern[1][0].mask = xye0.mask # transfer the mask
    2547         if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
     2551        if Page.plotStyle['qPlot'] and 'PWDR' in plottype:
    25482552            X = 2.*np.pi/G2lat.Pos2dsp(Parms,xye0)
    2549         elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:
     2553        elif Page.plotStyle['dPlot'] and 'PWDR' in plottype:
    25502554            X = G2lat.Pos2dsp(Parms,xye0)
    25512555        else:
     
    25582562        multArray = np.ones_like(Pattern[1][0])
    25592563        if 'PWDR' in plottype and G2frame.SinglePlot and not (
    2560                 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     2564                Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    25612565            magLineList = data[0].get('Magnification',[])
    2562             if ('C' in ParmList[0]['Type'][0] and G2frame.plotStyle['dPlot']
    2563                 ) or ('T' in ParmList[0]['Type'][0] and G2frame.plotStyle['qPlot']
     2566            if ('C' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']
     2567                ) or ('T' in ParmList[0]['Type'][0] and Page.plotStyle['qPlot']
    25642568                ): # reversed regions relative to data order
    25652569                tcorner = 1
     
    25812585                    continue
    25822586                multArray[Pattern[1][0]>x] = m
    2583                 if G2frame.plotStyle['qPlot']:
     2587                if Page.plotStyle['qPlot']:
    25842588                    x = 2.*np.pi/G2lat.Pos2dsp(Parms,x)
    2585                 elif G2frame.plotStyle['dPlot']:
     2589                elif Page.plotStyle['dPlot']:
    25862590                    x = G2lat.Pos2dsp(Parms,x)
    25872591                # is range in displayed range (defined after newplot)?
     
    26042608            multArray = ma.getdata(multArray)
    26052609        if 'PWDR' in plottype:
    2606             if G2frame.plotStyle['sqrtPlot']:
     2610            if Page.plotStyle['sqrtPlot']:
    26072611                olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    26082612                Y = np.where(xye[1]+bxye>=0.,np.sqrt(xye[1]+bxye),-np.sqrt(-xye[1]-bxye))
    26092613                np.seterr(invalid=olderr['invalid'])
    26102614            elif 'PWDR' in plottype and G2frame.SinglePlot and not (
    2611                 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     2615                Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    26122616                Y = xye[1]*multArray+bxye+NoffY*Ymax/100.0
    26132617            else:
     
    26182622            else:
    26192623                B = np.zeros_like(xye[5])
    2620             if G2frame.plotStyle['sqPlot']:
     2624            if Page.plotStyle['sqPlot']:
    26212625                Y = xye[1]*Sample['Scale'][0]*(1.05)**NoffY*X**4
    26222626            else:
     
    26252629            limits = np.array(G2frame.GPXtree.GetItemPyData(LimitId))
    26262630            lims = limits[1]
    2627             if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:
     2631            if Page.plotStyle['qPlot'] and 'PWDR' in plottype:
    26282632                lims = 2.*np.pi/G2lat.Pos2dsp(Parms,lims)
    2629             elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:
     2633            elif Page.plotStyle['dPlot'] and 'PWDR' in plottype:
    26302634                lims = G2lat.Pos2dsp(Parms,lims)
    26312635            Lines.append(Plot.axvline(lims[0],color='g',dashes=(5,5),picker=3.))   
     
    26502654            else:
    26512655                pP = ''
    2652             if plottype in ['SASD','REFD'] and G2frame.logPlot:
     2656            if plottype in ['SASD','REFD'] and Page.plotStyle['logPlot']:
    26532657                X *= (1.01)**(offsetX*N)
    26542658            else:
     
    26582662            Xum = ma.getdata(X) # unmasked version of X, use to plot data (only)
    26592663            if ifpicked:
    2660                 if G2frame.plotStyle['sqrtPlot']:
     2664                if Page.plotStyle['sqrtPlot']:
    26612665                    olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    26622666                    Z = np.where(xye[3]>=0.,np.sqrt(xye[3]),-np.sqrt(-xye[3]))
     
    26642668                else:
    26652669                    if 'PWDR' in plottype and G2frame.SinglePlot and not (
    2666                         G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     2670                        Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    26672671                        Z = xye[3]*multArray+NoffY*Ymax/100.0
    26682672                    else:
    26692673                        Z = xye[3]+NoffY*Ymax/100.0
    26702674                if 'PWDR' in plottype:
    2671                     if G2frame.plotStyle['sqrtPlot']:
     2675                    if Page.plotStyle['sqrtPlot']:
    26722676                        olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
    26732677                        W = np.where(xye[4]>=0.,np.sqrt(xye[4]),-np.sqrt(-xye[4]))
     
    26752679                        D = np.where(xye[5],(Y-Z),0.)-Pattern[0]['delOffset']
    26762680                    elif 'PWDR' in plottype and G2frame.SinglePlot and not (
    2677                         G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):
     2681                        Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour):
    26782682                        W = xye[4]*multArray+NoffY*Ymax/100.0
    26792683                        D = multArray*xye[5]-Pattern[0]['delOffset']  #powder background
     
    26822686                        D = xye[5]-Pattern[0]['delOffset']  #powder background
    26832687                elif plottype in ['SASD','REFD']:
    2684                     if G2frame.plotStyle['sqPlot']:
     2688                    if Page.plotStyle['sqPlot']:
    26852689                        W = xye[4]*X**4
    26862690                        Z = xye[3]*X**4
     
    27082712                    Plot1.axhline(0.,color='k')
    27092713                    Plot1.set_ylim(bottom=np.min(DZ[Ibeg:Ifin])*1.2,top=np.max(DZ[Ibeg:Ifin])*1.2) 
    2710                 if G2frame.logPlot:
     2714                if Page.plotStyle['logPlot']:
    27112715                    if 'PWDR' in plottype:
    27122716                        Plot.set_yscale("log",nonposy='mask')
     
    27202724                        Plot.set_yscale("log",nonposy='mask')
    27212725                        if G2frame.ErrorBars:
    2722                             if G2frame.plotStyle['sqPlot']:
     2726                            if Page.plotStyle['sqPlot']:
    27232727                                Plot.errorbar(X,YB,yerr=X**4*Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])),
    27242728                                    ecolor=colors[0],picker=3.,clip_on=Clip_on)
     
    27642768                            else:
    27652769                                Ni = N
    2766                             if G2frame.plotStyle['qPlot']:
     2770                            if Page.plotStyle['qPlot']:
    27672771                                Lines.append(Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,item[0]),color=colors[Ni%6],picker=2.))
    2768                             elif G2frame.plotStyle['dPlot']:
     2772                            elif Page.plotStyle['dPlot']:
    27692773                                Lines.append(Plot.axvline(G2lat.Pos2dsp(Parms,item[0]),color=colors[Ni%6],picker=2.))
    27702774                            else:
     
    27792783            else:   #not picked
    27802784                icolor = 256*N//len(PlotList)
    2781                 if G2frame.logPlot:
     2785                if Page.plotStyle['logPlot']:
    27822786                    if 'PWDR' in plottype:
    27832787                        Plot.semilogy(X,Y,color=mcolors.cmap(icolor),picker=False,nonposy='mask')
     
    27912795                        Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.)
    27922796                           
    2793                 if G2frame.logPlot and 'PWDR' in plottype:
     2797                if Page.plotStyle['logPlot'] and 'PWDR' in plottype:
    27942798                    Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.)
    27952799#    if not G2frame.SinglePlot and not G2frame.Contour:
     
    28062810            for peak in peaks[0]:
    28072811                if peak[2]:
    2808                     if G2frame.plotStyle['qPlot']:
     2812                    if Page.plotStyle['qPlot']:
    28092813                        Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,peak[0]),color='b')
    2810                     if G2frame.plotStyle['dPlot']:
     2814                    if Page.plotStyle['dPlot']:
    28112815                        Plot.axvline(G2lat.Pos2dsp(Parms,peak[0]),color='b')
    28122816                    else:
     
    28162820                if len(hkl) > 6 and hkl[3]:
    28172821                    clr = 'g'
    2818                 if G2frame.plotStyle['qPlot']:
     2822                if Page.plotStyle['qPlot']:
    28192823                    Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=(5,5))
    2820                 if G2frame.plotStyle['dPlot']:
     2824                if Page.plotStyle['dPlot']:
    28212825                    Plot.axvline(G2lat.Pos2dsp(Parms,hkl[-2]),color=clr,dashes=(5,5))
    28222826                else:
     
    28402844                pos = Pattern[0]['refOffset']-pId*Pattern[0]['refDelt']*np.ones_like(peak)
    28412845                plsym = Page.phaseColors.get(phase,'y')+'|' # yellow should never happen!
    2842                 if G2frame.plotStyle['qPlot']:
     2846                if Page.plotStyle['qPlot']:
    28432847                    Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase)
    2844                 elif G2frame.plotStyle['dPlot']:
     2848                elif Page.plotStyle['dPlot']:
    28452849                    Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase)
    28462850                else:
     
    28702874            if G2frame.SubBack or G2frame.Weight or G2frame.Contour or not G2frame.SinglePlot:
    28712875                break
    2872             if y < 0 and (G2frame.plotStyle['sqrtPlot'] or G2frame.logPlot):
     2876            if y < 0 and (Page.plotStyle['sqrtPlot'] or Page.plotStyle['logPlot']):
    28732877                y = Page.figure.gca().get_ylim()[0] # put out of range point at bottom of plot
    2874             elif G2frame.plotStyle['sqrtPlot']:
     2878            elif Page.plotStyle['sqrtPlot']:
    28752879                y = math.sqrt(y)
    2876             if G2frame.plotStyle['qPlot']:     #Q - convert from 2-theta
     2880            if Page.plotStyle['qPlot']:     #Q - convert from 2-theta
    28772881                if Parms:
    28782882                    x = 2*np.pi/G2lat.Pos2dsp(Parms,x)
    28792883                else:
    28802884                    break
    2881             elif G2frame.plotStyle['dPlot']:   #d - convert from 2-theta
     2885            elif Page.plotStyle['dPlot']:   #d - convert from 2-theta
    28822886                if Parms:
    28832887                    x = G2lat.Dsp2pos(Parms,x)
     
    28922896        Plot.set_xlim(G2frame.xylim[0])
    28932897        Plot.set_ylim(G2frame.xylim[1])
    2894 #        xylim = []
    28952898        Page.toolbar.push_current()
    28962899        Page.toolbar.draw()
     
    29002903    olderr = np.seterr(invalid='ignore') #ugh - this removes a matplotlib error for mouse clicks in log plots
    29012904    # and sqrt(-ve) in np.where usage               
    2902 #    G2frame.Pwdr = True
    29032905    if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId):
    29042906        if len(Page.tickDict.keys()) == 1:
     
    57565758                Data['invert_y'] = not Data['invert_y']
    57575759            elif event.key in ['s',] and Data['linescan'][0]:
    5758                 G2frame.logPlot = False
    5759                 G2frame.plotStyle['sqrtPlot'] = not G2frame.plotStyle['sqrtPlot']
     5760                Page.plotStyle['logPlot'] = False
     5761                Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot']
    57605762            elif event.key in ['n',] and Data['linescan'][0]:
    5761                 G2frame.plotStyle['sqrtPlot'] = False
    5762                 G2frame.logPlot = not G2frame.logPlot
     5763                Page.plotStyle['sqrtPlot'] = False
     5764                Page.plotStyle['logPlot'] = not Page.plotStyle['logPlot']
    57635765            else:
    57645766                return
     
    58415843                xy = G2img.GetLineScan(G2frame.ImageZ,Data)
    58425844                Plot1.cla()
    5843                 if G2frame.logPlot:
     5845                olderr = np.seterr(invalid='ignore') #get around sqrt/log(-ve) error
     5846                if Page.plotStyle['logPlot']:
    58445847                    xy[1] = np.log(xy[1])
    5845                 elif G2frame.plotStyle['sqrtPlot']:
     5848                elif Page.plotStyle['sqrtPlot']:
    58465849                    xy[1] = np.sqrt(xy[1])
     5850                np.seterr(invalid=olderr['invalid'])
    58475851                Plot1.plot(xy[0],xy[1])
    58485852                Plot1.set_xlim(Data['IOtth'])
     
    62876291        Plot1.set_ylabel('Intensity',fontsize=12)
    62886292        xy = G2img.GetLineScan(G2frame.ImageZ,Data)
    6289         if G2frame.logPlot:
     6293        olderr = np.seterr(invalid='ignore') #get around sqrt(-ve) error
     6294        if Page.plotStyle['logPlot']:
    62906295            xy[1] = np.log(xy[1])
    62916296            Plot1.set_ylabel('log(Intensity)',fontsize=12)
    6292         elif G2frame.plotStyle['sqrtPlot']:
     6297        elif Page.plotStyle['sqrtPlot']:
    62936298            Plot1.set_ylabel(r'$\sqrt{Intensity}$',fontsize=12)
    62946299            xy[1] = np.sqrt(xy[1])
     6300        np.seterr(invalid=olderr['invalid'])
    62956301        Plot1.plot(xy[0],xy[1])
    62966302        Plot1.set_xlim(Data['IOtth'])
Note: See TracChangeset for help on using the changeset viewer.