@@ -188,15 +188,17 @@ def OnPlotKeyPress(event):
188188 except TypeError :
189189 G2frame .G2plotNB .status .SetStatusText (f'Select { plottype } pattern first' ,1 )
190190 return
191+ if 'GROUP' in plottype : # save plot limits in case we want to restore them
192+ G2frame .G2plotNB .savePlotLims (Page )
191193 newPlot = False
192- if event .key == 'w' :
194+ if event .key == 'w' and not 'GROUP' in plottype :
193195 G2frame .Weight = not G2frame .Weight
194196 if not G2frame .Weight and not G2frame .Contour and 'PWDR' in plottype :
195197 G2frame .SinglePlot = True
196198 elif 'PWDR' in plottype : # Turning on Weight plot clears previous limits
197199 G2frame .FixedLimits ['dylims' ] = ['' ,'' ]
198200 #newPlot = True # this resets the x & y limits, not wanted!
199- elif event .key in ['shift+1' ,'!' ]: # save current plot settings as defaults
201+ elif event .key in ['shift+1' ,'!' ] and not 'GROUP' in plottype : # save current plot settings as defaults
200202 # shift+1 assumes US keyboard
201203 print ('saving plotting defaults for' ,G2frame .GPXtree .GetItemText (G2frame .PatternId ))
202204 data = G2frame .GPXtree .GetItemPyData (G2frame .PatternId )
@@ -213,6 +215,7 @@ def OnPlotKeyPress(event):
213215 elif event .key == 'f' and ('PWDR' in plottype or 'GROUP' in plottype ): # short,full length or no tick-marks
214216 if G2frame .Contour : return
215217 Page .plotStyle ['flTicks' ] = (Page .plotStyle .get ('flTicks' ,0 )+ 1 )% 3
218+ if 'GROUP' in plottype : G2frame .restorePlotLimits = True
216219 elif event .key == 'x' and groupName is not None : # share X axis scale for Pattern Groups
217220 plotOpt ['sharedX' ] = not plotOpt ['sharedX' ]
218221 # Clear saved x-limits when toggling sharedX mode (MG/Cl Sonnet)
@@ -304,6 +307,7 @@ def OnPlotKeyPress(event):
304307 elif Page .plotStyle ['Offset' ][0 ] > - 100. :
305308 Page .plotStyle ['Offset' ][0 ] -= 10.
306309 elif event .key == 'g' :
310+ if 'GROUP' in plottype : G2frame .restorePlotLimits = True
307311 mpl .rcParams ['axes.grid' ] = not mpl .rcParams ['axes.grid' ]
308312 elif event .key == 'l' and not G2frame .SinglePlot :
309313 Page .plotStyle ['Offset' ][1 ] -= 1.
@@ -2257,7 +2261,7 @@ def onGroupXlimChanged(ax):
22572261 Page .Choice = [' key press' ,
22582262 'f: toggle full-length ticks' ,
22592263 'g: toggle grid' ,
2260- 's: toggle sqrt plot' ,
2264+ # 's: toggle sqrt plot', # TODO: implement this
22612265 'q: toggle Q plot' ,
22622266 't: toggle d-spacing plot' ,
22632267 'x: share x-axes (Q/d only)' ]
@@ -2326,7 +2330,7 @@ def onGroupXlimChanged(ax):
23262330 totalrange += gXmax [i ]- gXmin [i ]
23272331 if plotOpt ['sharedX' ] and (
23282332 Page .plotStyle ['qPlot' ] or Page .plotStyle ['dPlot' ]):
2329- Page .figure .text (0.001 ,0.94 ,'X shared' ,fontsize = 11 ,
2333+ Page .figure .text (0.94 ,0.03 ,'X shared' ,fontsize = 10 ,
23302334 color = 'g' )
23312335 GS_kw = {'height_ratios' :[4 , 1 ]}
23322336 #Plots = Page.figure.subplots(2,Page.groupN,sharey='row',sharex=True,
@@ -2484,8 +2488,8 @@ def onGroupXlimChanged(ax):
24842488 (Page .plotStyle ['qPlot' ] or Page .plotStyle ['dPlot' ])):
24852489 up ,down = adjustDim (0 ,Page .groupN )
24862490 G2frame .groupXlim = Plots [up ].get_xlim ()
2491+ wx .CallAfter (G2frame .G2plotNB .restoreSavedPlotLims ,Page ) # restore limits to previous, if saved & requested
24872492 Page .canvas .draw ()
2488- wx .CallLater (100 ,G2frame .G2plotNB .restoreSavedPlotLims ,Page ) # restore limits to previous, if saved
24892493 return # end of group plot
24902494 elif G2frame .Weight and not G2frame .Contour :
24912495 Plot .set_visible (False ) #hide old plot frame, will get replaced below
0 commit comments