Skip to content
Snippets Groups Projects
Commit 0d332667 authored by leufen1's avatar leufen1
Browse files

added limit for x or y axis

parent 5c72060a
Branches
Tags
5 merge requests!319add all changes of dev into release v1.4.0 branch,!318Resolve "release v1.4.0",!299Draft: Merge default data handler and preprocessing support parameter use_multiprocessing....,!286Resolve "refac: limit axis in competing skill score plot",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #65184 passed
This commit is part of merge request !318. Comments created here will be created in the context of that merge request.
......@@ -659,7 +659,7 @@ class PlotClimatologicalSkillScore(AbstractPlotClass):
"""
return "" if score_only else "terms and "
def _plot(self, score_only):
def _plot(self, score_only, xlim=5):
"""
Plot climatological skill score.
......@@ -672,6 +672,8 @@ class PlotClimatologicalSkillScore(AbstractPlotClass):
showmeans=True, meanprops={"markersize": 1, "markeredgecolor": "k"}, flierprops={"marker": "."})
ax.axhline(y=0, color="grey", linewidth=.5)
ax.set(ylabel=f"{self._label_add(score_only)}skill score", xlabel="", title="summary of all stations")
x_min, x_max = ax.get_xlim()
ax.set_xlim([max(x_min, -xlim), min(x_max, xlim)])
handles, _ = ax.get_legend_handles_labels()
ax.legend(handles, self._labels)
plt.tight_layout()
......@@ -737,7 +739,7 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
data = data.stack(level=0).reset_index(level=2, drop=True).reset_index(name="data")
return data.astype({"comparison": str, "ahead": int, "data": float})
def _plot(self, single_model_comparison=False):
def _plot(self, single_model_comparison=False, xlim=5):
"""Plot skill scores of the comparisons."""
size = max([len(np.unique(self._data.comparison)), 6])
fig, ax = plt.subplots(figsize=(size, size * 0.8))
......@@ -749,12 +751,14 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
ax.axhline(y=0, color="grey", linewidth=.5)
ax.set(ylabel="skill score", xlabel="competing models", title="summary of all stations", ylim=self._lim())
x_min, x_max = ax.get_xlim()
ax.set_xlim([max(x_min, -xlim), min(x_max, xlim)])
handles, _ = ax.get_legend_handles_labels()
plt.xticks(rotation=90)
ax.legend(handles, self._labels)
plt.tight_layout()
def _plot_vertical(self, single_model_comparison=False):
def _plot_vertical(self, single_model_comparison=False, ylim=5):
"""Plot skill scores of the comparisons, but vertically aligned."""
fig, ax = plt.subplots()
data = self._filter_comparisons(self._data) if single_model_comparison is True else self._data
......@@ -765,6 +769,8 @@ class PlotCompetitiveSkillScore(AbstractPlotClass):
# 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())
y_min, y_max = ax.get_ylim()
ax.set_ylim([max(y_min, -ylim), min(y_max, ylim)])
handles, _ = ax.get_legend_handles_labels()
ax.legend(handles, self._labels)
plt.tight_layout()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment