From b3e54cd396a34a14d8a353470274963baefe40c1 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Wed, 24 Apr 2024 18:26:52 +0200
Subject: [PATCH] Fix manipulating collections for newer matplotlib

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

diff --git a/src/cal_tools/plotting.py b/src/cal_tools/plotting.py
index 255dd7cc7..db92740e6 100644
--- a/src/cal_tools/plotting.py
+++ b/src/cal_tools/plotting.py
@@ -13,6 +13,7 @@ from extra_geom import (
 )
 from extra_geom import tests as eg_tests
 from matplotlib import colors
+from matplotlib.collections import PatchCollection
 from matplotlib.patches import Patch
 from mpl_toolkits.axes_grid1 import AxesGrid
 
@@ -306,8 +307,12 @@ def show_processed_modules(
     ax.set_axis_off()
     ax.get_legend().set_visible(False)
 
+    tiles = [c for c in ax.collections if isinstance(c, PatchCollection)][0]
+
     # Remove non-tiles markings from figure
-    tiles, = ax.collections = ax.collections[:1]
+    for coll in ax.collections:
+        if coll is not tiles:
+            coll.remove()
 
     # Set each tile colour individually, extra_geom provides a single color
     # for all tiles.
-- 
GitLab