diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 4855f16c33fa705085b36a07b12e9ee527f17691..d769fabce5702ceb6bb29cf726b4ccf82657ebb4 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -762,8 +762,7 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): showmeans=True, meanprops={"markersize": 3, "markeredgecolor": "k"}, flierprops={"marker": "."}, order=order) ax.axhline(y=0, color="grey", linewidth=.5) - - ax.set(ylabel="skill score", xlabel="competing models", title="summary of all stations", ylim=self._lim()) + ax.set(ylabel="skill score", xlabel="competing models", title="summary of all stations", ylim=self._lim(data)) handles, _ = ax.get_legend_handles_labels() plt.xticks(rotation=90) ax.legend(handles, self._labels) @@ -777,9 +776,8 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): sns.boxplot(y="comparison", x="data", hue="ahead", data=data, whis=1., ax=ax, palette="Blues_d", showmeans=True, meanprops={"markersize": 3, "markeredgecolor": "k"}, flierprops={"marker": "."}, order=order) - # ax.axhline(x=0, color="grey", linewidth=.5) ax.axvline(x=0, color="grey", linewidth=.5) - ax.set(xlabel="skill score", ylabel="competing models", title="summary of all stations", xlim=self._lim()) + ax.set(xlabel="skill score", ylabel="competing models", title="summary of all stations", xlim=self._lim(data)) handles, _ = ax.get_legend_handles_labels() ax.legend(handles, self._labels) plt.tight_layout() @@ -795,7 +793,8 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): filtered_headers = list(filter(lambda x: "nn-" in x, data.comparison.unique())) return data[data.comparison.isin(filtered_headers)] - def _lim(self) -> Tuple[float, float]: + @staticmethod + def _lim(data) -> Tuple[float, float]: """ Calculate axis limits from data (Can be used to set axis extend). @@ -805,8 +804,8 @@ class PlotCompetitiveSkillScore(AbstractPlotClass): :return: """ limit = 5 - lower = np.max([-limit, np.min([0, helpers.float_round(self._data.min()[2], 2) - 0.1])]) - upper = np.min([limit, helpers.float_round(self._data.max()[2], 2) + 0.1]) + lower = np.max([-limit, np.min([0, helpers.float_round(data.min()[2], 2) - 0.1])]) + upper = np.min([limit, helpers.float_round(data.max()[2], 2) + 0.1]) return lower, upper