From aec16e183731ec03c54983c7e39c44f82f8edf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Ha=C3=ABck?= <52320542+Descanonge@users.noreply.github.com> Date: Thu, 16 Jul 2026 14:36:47 +0200 Subject: [PATCH] Pass missing attributes to base cmap --- viscm/gui.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/viscm/gui.py b/viscm/gui.py index a3dc4bd..d3dd33f 100644 --- a/viscm/gui.py +++ b/viscm/gui.py @@ -113,11 +113,7 @@ def _setup_Jpapbp_axis(ax): # Adapt a matplotlib colormap to a linearly transformed version -- useful for # visualizing how colormaps look given color deficiency. # Kinda a hack, b/c we inherit from Colormap (this is required), but then -# ignore its implementation entirely. This results in errors at runtime: -# File "//site-packages/matplotlib/artist.py", line 1343, in format_cursor_data # noqa: E501 -# n = self.cmap.N -# ^^^^^^^^^^^ -# AttributeError: 'TransformedCMap' object has no attribute 'N' +# ignore its implementation entirely. class TransformedCMap(matplotlib.colors.Colormap): def __init__(self, transform, base_cmap): self.transform = transform @@ -131,17 +127,8 @@ def __call__(self, *args, **kwargs): return (tfx * 255).astype("uint8") return tfx - def set_bad(self, *args, **kwargs): - self.base_cmap.set_bad(*args, **kwargs) - - def set_under(self, *args, **kwargs): - self.base_cmap.set_under(*args, **kwargs) - - def set_over(self, *args, **kwargs): - self.base_cmap.set_over(*args, **kwargs) - - def is_gray(self): - return False + def __getattr__(self, name): + return getattr(self.base_cmap, name) def _vis_axes(fig):