diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 6d2d5ebd2871bb11bb74363dd4385f5abe687300..8ed634b657fb365606deb5acbb819d1a9a5ba3d3 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -1004,6 +1004,7 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): def __init__(self, data: xr.DataArray, plot_folder: str = ".", model_type_dim: str = "type", error_measure: str = "mse", error_unit: str = None, dim_name_boots: str = 'boots'): super().__init__(plot_folder, "sample_uncertainty_from_bootstrap") + default_name = self.plot_name self.model_type_dim = model_type_dim self.error_measure = error_measure self.dim_name_boots = dim_name_boots @@ -1011,9 +1012,16 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): self.prepare_data(data) self._plot(orientation="v") - self.plot_name = self.plot_name + "_horizontal" + self.plot_name = default_name + "_horizontal" self._plot(orientation="h") + self._apply_root() + + self.plot_name = default_name + "_sqrt" + self._plot(orientation="v") + + self.plot_name = default_name + "_horizontal_sqrt" + self._plot(orientation="h") self._data_table = None self._n_boots = None @@ -1022,6 +1030,11 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): self._data_table = data.to_pandas() self._n_boots = self._data_table.shape[0] + def _apply_root(self): + self._data_table = np.sqrt(self._data_table) + self.error_measure = f"root {self.error_measure}" + self.error_unit = self.error_unit.replace("$^2$", "") + def _plot(self, orientation: str = "v"): data_table = self._data_table n_boots = self._n_boots @@ -1039,7 +1052,7 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass): boxprops={'facecolor': 'none', 'edgecolor': 'k'}, width=.3, orient=orientation) if orientation == "v": - ax.set_ylabel(f"{self.error_measure} (in {self.error_unit})") + ax.set_ylabel(f"{self.error_measure} (in {self.error_unit})") ax.set_xticklabels(ax.get_xticklabels(), rotation=45) elif orientation == "h": ax.set_xlabel(f"{self.error_measure} (in {self.error_unit})")