From 253a957dbe4a35852892ab08c98db1bfcbc2b8df Mon Sep 17 00:00:00 2001 From: leufen1 <l.leufen@fz-juelich.de> Date: Thu, 21 Jan 2021 10:47:08 +0100 Subject: [PATCH] labels are rotated and figsize is dynamically adjusted now, /close #260 --- mlair/plotting/postprocessing_plotting.py | 5 +++-- mlair/run_modules/experiment_setup.py | 2 +- mlair/run_modules/post_processing.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 2c7d8fde..c9602673 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -726,7 +726,8 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): def _plot(self): """Plot skill scores of the comparisons.""" - fig, ax = plt.subplots() + size = max([len(np.unique(self._data.comparison)), 6]) + fig, ax = plt.subplots(figsize=(size, size * 0.8)) order = self._create_pseudo_order() sns.boxplot(x="comparison", y="data", hue="ahead", data=self._data, whis=1., ax=ax, palette="Blues_d", showmeans=True, meanprops={"markersize": 3, "markeredgecolor": "k"}, flierprops={"marker": "."}, @@ -735,7 +736,7 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): ax.set(ylabel="skill score", xlabel="competing models", title="summary of all stations", ylim=self._lim()) handles, _ = ax.get_legend_handles_labels() - plt.xticks(rotation=20) + plt.xticks(rotation=90) ax.legend(handles, self._labels) plt.tight_layout() diff --git a/mlair/run_modules/experiment_setup.py b/mlair/run_modules/experiment_setup.py index e772bbaa..34da6cb3 100644 --- a/mlair/run_modules/experiment_setup.py +++ b/mlair/run_modules/experiment_setup.py @@ -346,7 +346,7 @@ class ExperimentSetup(RunEnvironment): self._set_param("neighbors", ["DEBW030"]) # TODO: just for testing # set competitors - self._set_param("competitors", helpers.to_list(competitors), default=[]) + self._set_param("competitors", competitors, default=[]) competitor_path_default = os.path.join(self.data_store.get("data_path"), "competitors", "_".join(self.data_store.get("target_var"))) self._set_param("competitor_path", competitor_path, default=competitor_path_default) diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py index ebcf105f..020f0a42 100644 --- a/mlair/run_modules/post_processing.py +++ b/mlair/run_modules/post_processing.py @@ -15,7 +15,7 @@ import xarray as xr from mlair.data_handler import BootStraps, KerasIterator from mlair.helpers.datastore import NameNotFoundInDataStore -from mlair.helpers import TimeTracking, statistics, extract_value, remove_items +from mlair.helpers import TimeTracking, statistics, extract_value, remove_items, to_list from mlair.model_modules.linear_model import OrdinaryLeastSquaredModel from mlair.model_modules.model_class import AbstractModelClass from mlair.plotting.postprocessing_plotting import PlotMonthlySummary, PlotStationMap, PlotClimatologicalSkillScore, \ @@ -81,7 +81,7 @@ class PostProcessing(RunEnvironment): self.skill_scores = None self.bootstrap_skill_scores = None self.competitor_path = self.data_store.get("competitor_path") - self.competitors = self.data_store.get_default("competitors", default=[]) + self.competitors = to_list(self.data_store.get_default("competitors", default=[])) self.forecast_indicator = "nn" self._run() -- GitLab