From 0217410b0db44d972d95b5a94cb7afa60fb85c1f Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Wed, 10 Jul 2024 09:30:37 +0100
Subject: [PATCH] Fix another usage of matplotlib Axes.collections

---
 src/cal_tools/plotting.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/cal_tools/plotting.py b/src/cal_tools/plotting.py
index 879dee04f..838e1fc17 100644
--- a/src/cal_tools/plotting.py
+++ b/src/cal_tools/plotting.py
@@ -392,9 +392,15 @@ def show_processed_modules_jungfrau(
     ax.set_axis_off()
     ax.get_legend().set_visible(False)
 
+    modules = [c for c in ax.collections if isinstance(c, PatchCollection)][0]
+
+    # Remove non-tiles markings from figure
+    for coll in ax.collections:
+        if coll is not modules:
+            coll.remove()
+
     # Set each module colour individually,
     # extra_geom provides a single color for all modules.
-    modules, = ax.collections = ax.collections[:1]
     facecolors = np.repeat(modules.get_facecolor(), len(expected_modules), axis=0)
 
     counter = 0  # Used as index within the `Noise` matrix
-- 
GitLab