From daf50518abe0002726dd14cb9357a886b50e373a Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Tue, 20 Oct 2026 07:55:44 +1000 Subject: [PATCH 1/2] Fix the ordering of initializing lut due to change in mpl version --- ultraplot/colors.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ultraplot/colors.py b/ultraplot/colors.py index 0604b715b..368383eb1 100644 --- a/ultraplot/colors.py +++ b/ultraplot/colors.py @@ -2084,13 +2084,17 @@ def _init(self): # Make hues circular, set extremes i.e. copy HSL values self._lut = self._lut_hsl.copy() - self._set_extremes() # generally just used end values in segmentdata - self._isinit = True - # Now convert values to RGB and clip colors - for i in range(self.N + 3): + # Convert the regular color entries to RGB + # Note: as of mpl 3.11 setting lut is not performed when + # updating set_extremes, as such there is an ordering effect + # here that we need to consider. + for i in range(self.N): self._lut[i, :3] = to_rgb(self._lut[i, :3], self._space) - self._lut[:, :3] = _clip_colors(self._lut[:, :3], self._clip) + self._lut[: self.N, :3] = _clip_colors(self._lut[: self.N, :3], self._clip) + + self._set_extremes() # generally just used end values in segmentdata + self._isinit = True @docstring._snippet_manager def set_gamma(self, gamma=None, gamma1=None, gamma2=None): From d4a3cc064bd1b96cc8a84da926736d5b7ed3a2bb Mon Sep 17 00:00:00 2001 From: cvanelteren Date: Tue, 20 Oct 2026 09:40:02 +1000 Subject: [PATCH 2/2] Ordering --- ultraplot/colors.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ultraplot/colors.py b/ultraplot/colors.py index 368383eb1..2be4b6b65 100644 --- a/ultraplot/colors.py +++ b/ultraplot/colors.py @@ -2093,8 +2093,10 @@ def _init(self): self._lut[i, :3] = to_rgb(self._lut[i, :3], self._space) self._lut[: self.N, :3] = _clip_colors(self._lut[: self.N, :3], self._clip) - self._set_extremes() # generally just used end values in segmentdata self._isinit = True + # Order here is important as + # mpl.3.11 only updates when init is set to true + self._set_extremes() # generally just used end values in segmentdata @docstring._snippet_manager def set_gamma(self, gamma=None, gamma1=None, gamma2=None):