@@ -8512,11 +8512,20 @@ def OnEditMag(**args):
85128512 G2frame .GPXtree .SetItemPyData (item ,data )
85138513 G2frame .PatternId = item
85148514 if kind in ['PWDR' ,'SASD' ,'REFD' ,]:
8515- NewPlot = True
8516- if 'Contour' in dir (G2frame ) and G2frame .Contour :
8517- pass
8518- elif 'xylim' in dir (G2frame ):
8515+ # When I added code to allow for contour plots from unequally spaced data
8516+ # I forced all contour plots to replot with newPlot=True. I'm not sure if
8517+ # this is actually needed and for autointegration we really don't want
8518+ # plots to rescale.
8519+ # NewPlot = True
8520+ # if getattr(G2frame,'Contour',False):
8521+ # pass
8522+ # if hasattr(G2frame,'xylim'):
8523+ # NewPlot = False
8524+ # now only rescale when needed
8525+ if hasattr (G2frame ,'xylim' ):
85198526 NewPlot = False
8527+ else :
8528+ NewPlot = True
85208529 # if GSASIIpath.GetConfigValue('debug'):
85218530 # from importlib import reload
85228531 # reload(G2pwpl)
@@ -8964,16 +8973,21 @@ def OnShowShift(event):
89648973 G2pdG .UpdatePeakGrid (G2frame ,data )
89658974 for i in G2frame .ExportPeakList : i .Enable (True )
89668975 newPlot = False
8967- if hasattr (G2frame ,'Contour' ):
8968- if G2frame .Contour :
8969- G2frame .Contour = False
8970- newPlot = True
8976+ if getattr (G2frame ,'Contour' ,'False' ):
8977+ G2frame .Contour = False
8978+ newPlot = True
89718979 G2pwpl .PlotPatterns (G2frame ,newPlot ,fromTree = True )
89728980 elif G2frame .GPXtree .GetItemText (item ) == 'Background' :
8981+ NewPlot = False # plot using previous limits
8982+ if getattr (G2frame ,'Contour' ,False ): # except if contour plot
8983+ G2frame .Contour = False
8984+ NewPlot = True
8985+ elif not hasattr (G2frame ,'xylim' ): # or no limits present
8986+ NewPlot = True
89738987 G2frame .PatternId = G2frame .GPXtree .GetItemParent (item )
89748988 data = G2frame .GPXtree .GetItemPyData (item )
89758989 G2pdG .UpdateBackground (G2frame ,data )
8976- G2pwpl .PlotPatterns (G2frame ,True ,fromTree = True )
8990+ G2pwpl .PlotPatterns (G2frame ,newPlot = NewPlot ,fromTree = True )
89778991 elif G2frame .GPXtree .GetItemText (item ) == 'Limits' :
89788992 G2frame .PatternId = G2frame .GPXtree .GetItemParent (item )
89798993 datatype = G2frame .GPXtree .GetItemText (G2frame .PatternId )[:4 ]
@@ -9035,10 +9049,9 @@ def OnShowShift(event):
90359049 G2plt .PlotPowderLines (G2frame )
90369050 else :
90379051 newPlot = False
9038- if hasattr (G2frame ,'Contour' ):
9039- if G2frame .Contour :
9040- G2frame .Contour = False
9041- newPlot = True
9052+ if getattr (G2frame ,'Contour' ,'False' ):
9053+ G2frame .Contour = False
9054+ newPlot = True
90429055 G2pwpl .PlotPatterns (G2frame ,newPlot ,fromTree = True )
90439056 elif G2frame .GPXtree .GetItemText (item ) == 'Unit Cells List' :
90449057 G2frame .PatternId = G2frame .GPXtree .GetItemParent (item )
@@ -9066,10 +9079,9 @@ def OnShowShift(event):
90669079 G2pdG .UpdateReflectionGrid (G2frame ,data )
90679080 G2frame .dataWindow .HideShow .Enable (False )
90689081 newPlot = False
9069- if hasattr (G2frame ,'Contour' ):
9070- if G2frame .Contour :
9071- G2frame .Contour = False
9072- newPlot = True
9082+ if getattr (G2frame ,'Contour' ,'False' ):
9083+ G2frame .Contour = False
9084+ newPlot = True
90739085 G2pwpl .PlotPatterns (G2frame ,newPlot ,fromTree = True )
90749086 elif G2frame .GPXtree .GetItemText (item ) == 'Reflection List' : #HKLF reflections
90759087 G2frame .PatternId = G2frame .GPXtree .GetItemParent (item )
0 commit comments