From 48d2f2df3011ca97dbadf5d68d56caf386644928 Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Wed, 18 May 2022 07:46:45 +0200
Subject: [PATCH] test different colorbars

---
 mlair/plotting/postprocessing_plotting.py | 32 ++++++++++++++---------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py
index 751282eb..68d31846 100644
--- a/mlair/plotting/postprocessing_plotting.py
+++ b/mlair/plotting/postprocessing_plotting.py
@@ -1302,19 +1302,25 @@ class PlotTimeEvolutionMetric(AbstractPlotClass):
         return min(max(1.25 * val + 7.5, 10), 30)
 
     def _plot(self, data, years, months, vmin=None, vmax=None, subtitle=None):
-        fig, ax = plt.subplots(figsize=(max(data.shape[1] / 5, 12), max(data.shape[0] / 3, 2)))
-        data.sort_index(inplace=True)
-        sns.heatmap(data, linewidths=1, cmap="coolwarm", ax=ax, vmin=vmin, vmax=vmax,
-                    cbar_kws={"aspect": self._aspect_cbar(data.shape[0])})
-        # or cmap="Spectral_r", cmap="RdYlBu_r", cmap="coolwarm",
-        # square=True
-        # , cbar_kws={"aspect": 10}
-        self._set_ticks(ax, years, months)
-        ax.set_xlabel(None)
-        ax.set_ylabel(None)
-        plt.title(self.title if subtitle is None else f"{subtitle}\n{self.title}")
-        plt.tight_layout()
-        self._save()
+        plot_name = self.plot_name
+        for c in ["Spectral_r", "RdYlBu_r", "coolwarm"]:
+            self.plot_name = plot_name + "_" + c
+            fig, ax = plt.subplots(figsize=(max(data.shape[1] / 5, 12), max(data.shape[0] / 3, 2)))
+            data.sort_index(inplace=True)
+            # sns.heatmap(data, linewidths=1, cmap="coolwarm", ax=ax, vmin=vmin, vmax=vmax,
+            #             cbar_kws={"aspect": self._aspect_cbar(data.shape[0])})
+            sns.heatmap(data, linewidths=1, cmap=c, ax=ax, vmin=vmin, vmax=vmax,
+                        cbar_kws={"aspect": self._aspect_cbar(data.shape[0])})
+            # or cmap="Spectral_r", cmap="RdYlBu_r", cmap="coolwarm",
+            # square=True
+            # , cbar_kws={"aspect": 10}
+            self._set_ticks(ax, years, months)
+            # ax.set_xlabel(None)
+            # ax.set_ylabel(None)
+            # plt.title(self.title if subtitle is None else f"{subtitle}\n{self.title}")
+            ax.set(xlabel=None, ylabel=None, title=self.title if subtitle is None else f"{subtitle}\n{self.title}")
+            plt.tight_layout()
+            self._save()
 
 
 if __name__ == "__main__":
-- 
GitLab