From a2202a0450bc41e7d56cd8977ea13c97bbad378b Mon Sep 17 00:00:00 2001
From: Felix Kleinert <f.kleinert@fz-juelich.de>
Date: Wed, 26 Jan 2022 16:57:44 +0100
Subject: [PATCH] include minimal delta for igificance_bars

---
 mlair/plotting/postprocessing_plotting.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py
index ae892631..3c8bb04e 100644
--- a/mlair/plotting/postprocessing_plotting.py
+++ b/mlair/plotting/postprocessing_plotting.py
@@ -1187,7 +1187,9 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass):  # pragma: no cover
             if not i == list(asteriks.index).index(self.model_name):
                 x2 = i
                 y = data_table[[self.model_name, data_table.columns[i]]].max().max()
-                y = max(y, (y + (y-y_prev)) * 1.025) * 1.025
+                y = max(y, y_prev) * 1.025
+                if abs(y-y_prev) < y * 0.025:
+                    y = y * 1.025
                 h = .01 * data_table.max().max()
                 ax.plot([x1, x1, x2, x2], [y, y + h, y + h, y], c="k")
                 ax.text((x1 + x2) * .5, y + h, v, ha="center", va="bottom", color="k")
@@ -1201,7 +1203,9 @@ class PlotSampleUncertaintyFromBootstrap(AbstractPlotClass):  # pragma: no cover
             if not i == list(asteriks.index).index(self.model_name):
                 y2 = i
                 x = data_table[[self.model_name, data_table.columns[i]]].max().max()
-                x = max(x, (x + (x-x_prev)) * 1.025) * 1.025
+                x = max(x, x_prev) * 1.025
+                if abs(x-x_prev) < x * 0.025:
+                    x = x * 1.025
                 h = .01 * data_table.max().max()
                 ax.plot([x, x+h, x+h, x], [y1, y1, y2, y2], c="k")
                 ax.text(x + h, (y1 + y2) * .5, v, ha="left", va="center", color="k", rotation=-90)
-- 
GitLab