diff --git a/kafe2/config/plot_style_color.yaml b/kafe2/config/plot_style_color.yaml index faca7474..4b18207b 100644 --- a/kafe2/config/plot_style_color.yaml +++ b/kafe2/config/plot_style_color.yaml @@ -2,7 +2,7 @@ colors: - &kafe_color1 '#200000' # red-black # - &kafe_color1 '#403018' # dunkle Kaffeebohne - &kafe_light_color1 '#E09060' # Latte Macchiato - - &kafe_color2 'navy' + - &kafe_color2 'royalblue' - &kafe_light_color2 'skyblue' - &kafe_color3 'darkgreen' - &kafe_light_color3 'yellowgreen' diff --git a/kafe2/fit/_base/plot.py b/kafe2/fit/_base/plot.py index 5bbc7432..be238d8f 100644 --- a/kafe2/fit/_base/plot.py +++ b/kafe2/fit/_base/plot.py @@ -643,14 +643,20 @@ def plot_pull(self, target_axes, error_contributions=("data",), **kwargs): """ _xmin, _xmax = self.x_range - target_axes.fill_between([_xmin, _xmax], -2, 2, color=[0.0, 0.0, 0.0, 0.1]) - target_axes.fill_between([_xmin, _xmax], -1, 1, color=[0.0, 0.0, 0.0, 0.1]) - target_axes.hlines(y=0, xmin=_xmin, xmax=_xmax, colors="black", linestyles=":") + _ymin, _ymax = target_axes.get_ylim() + _pull = (self.data_y - self.model_y) / self._get_total_error(error_contributions) - _yerr = self._get_total_error(error_contributions) - _pull = (self.data_y - self.model_y) / _yerr + _xerr = 0.0125 * (_xmax - _xmin) + # fmt: off + _yerr = np.array([ + np.where(_pull < 0, 0, np.abs(_pull)), + np.where(_pull > 0, 0, np.abs(_pull)) + ]) + # fmt: on - return target_axes.errorbar(self.data_x, _pull, xerr=0, yerr=0, **kwargs) + target_axes.hlines(y=0, xmin=_xmin, xmax=_xmax, colors="black", linestyles=":") + kwargs["marker"] = None + return target_axes.errorbar(self.data_x, _pull, xerr=_xerr, yerr=_yerr, **kwargs) # Overridden by multi plot adapters def get_formatted_model_function(self, **kwargs): @@ -1402,7 +1408,7 @@ def plot( _axis.set_ylabel(_pull_label) if pull_range is None: _plot_adapters = self._get_plot_adapters()[i : i + 1] if self._separate_figs else self._get_plot_adapters() - _max_abs_deviation = 2 # Ensure 1 sigma/2 sigma bands are visible + _max_abs_deviation = 0 for _plot_adapter in _plot_adapters: _max_abs_deviation = max( _max_abs_deviation,