@@ -1905,14 +1905,15 @@ def update_wppf_plot(self):
19051905 axis .autoscale_view (scalex = False )
19061906
19071907 if diff_axis and wppf_data and last_lineout :
1908+ is_percent = HexrdConfig ().show_wppf_difference_as_percent
19081909 style = {
19091910 'c' : '#000000' ,
19101911 'ls' : 'solid' ,
19111912 'lw' : 1.0 ,
19121913 }
19131914 x = wppf_data [0 ]
19141915 y = wppf_data [1 ] - last_lineout [1 ].filled (np .nan )
1915- if HexrdConfig (). show_wppf_difference_as_percent :
1916+ if is_percent :
19161917 # Express `y` as a percentage instead
19171918 y *= 100 / last_lineout [1 ].filled (np .nan )
19181919
@@ -1922,11 +1923,15 @@ def update_wppf_plot(self):
19221923 diff_axis .relim ()
19231924 diff_axis .autoscale_view (scalex = False )
19241925
1925- # When the difference plot resets, always set it to be
1926- # initially the same y range as the azimuthal.
1927- new_ymin = min (diff_axis .get_ylim ()[0 ], - axis .get_ylim ()[1 ])
1928- new_ymax = max (diff_axis .get_ylim ()[1 ], axis .get_ylim ()[1 ])
1929- diff_axis .set_ylim ((new_ymin , new_ymax ))
1926+ if is_percent :
1927+ # Force an auto-scale
1928+ diff_axis .autoscale (enable = True , axis = 'y' )
1929+ else :
1930+ # When the difference plot resets, always set it to be
1931+ # initially the same y range as the azimuthal.
1932+ new_ymin = min (diff_axis .get_ylim ()[0 ], - axis .get_ylim ()[1 ])
1933+ new_ymax = max (diff_axis .get_ylim ()[1 ], axis .get_ylim ()[1 ])
1934+ diff_axis .set_ylim ((new_ymin , new_ymax ))
19301935
19311936 # Update the difference label even if there's no data
19321937 self .update_wppf_difference_labels ()
0 commit comments