@@ -121,21 +121,25 @@ def plot(self, diff=None, hkl=None, figsize=(9, 4), fontsize_hkl=6, reset=False,
121121 plt .figure (figsize = figsize )
122122 plt .plot (x , obs , 'k' , label = 'obs' , linewidth = 1 )
123123 plt .plot (x , calc , 'r' , label = 'calc' , linewidth = 1 )
124+ m = self .GetMaxSinThetaOvLambda () * self .GetWavelength ()
125+ mtth = np .rad2deg (np .arcsin (m )) * 2
124126 if plot_diff :
125- plt .plot (x , calc - obs - obs .max () / 20 , 'g' , label = 'calc-obs' ,
127+ diff = calc - obs - obs .max () / 20
128+ # Mask difference above max sin(theta)/lambda
129+ diff = np .ma .masked_array (diff , x > mtth )
130+ plt .plot (x , diff , 'g' , label = 'calc-obs' ,
126131 linewidth = 0.5 )
127132
128133 plt .legend (loc = 'upper right' )
129134 if self .GetName () != "" :
130135 plt .title ("PowderPattern: %s" % self .GetName ())
131136
132- m = self .GetMaxSinThetaOvLambda () * self .GetWavelength ()
133137 if self ._plot_ylim is not None :
134138 plt .ylim (self ._plot_ylim )
135139 if self ._plot_xlim is not None :
136140 plt .xlim (self ._plot_xlim )
137141 elif m < 1 :
138- plt .xlim (x .min (), np . rad2deg ( np . arcsin ( m )) * 2 )
142+ plt .xlim (x .min (), mtth )
139143
140144 if plot_hkl :
141145 self ._do_plot_hkl (nb_max = 100 , fontsize_hkl = fontsize_hkl )
0 commit comments