From 93dc83505d9ab2985939b7ea7158616c74670959 Mon Sep 17 00:00:00 2001 From: Matthias Schabel Date: Thu, 6 Aug 2026 19:24:10 -0700 Subject: [PATCH] fix: mark glasbey as qualitative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Glasbey's palette is 256 maximally distinct colors for labelling categories (Glasbey et al., doi:10.1002/col.20327), but is recorded as a continuous `miscellaneous` colormap. Consequences: it is interpolated between colors that denote unrelated categories, and `Colormap("glasbey").lut(1000)` returns 1000 colors rather than the 256 that exist. Measured, the median CIE Lab step between adjacent entries is 75.7 — within the 19.3–116.6 range spanned by the catalog's own qualitative colormaps, and nowhere near its continuous ones (0.9 for matplotlib:viridis). --- src/cmap/data/glasbey/record.json | 5 +++-- tests/test_glasbey.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/cmap/data/glasbey/record.json b/src/cmap/data/glasbey/record.json index a317073c8..c370531e4 100644 --- a/src/cmap/data/glasbey/record.json +++ b/src/cmap/data/glasbey/record.json @@ -4,8 +4,9 @@ ], "colormaps": { "glasbey": { - "category": "miscellaneous", - "data": "cmap.data.glasbey.prebuilt:glasbey" + "category": "qualitative", + "data": "cmap.data.glasbey.prebuilt:glasbey", + "interpolation": false } }, "license": "CC0", diff --git a/tests/test_glasbey.py b/tests/test_glasbey.py index 4b427df59..f061c6aab 100644 --- a/tests/test_glasbey.py +++ b/tests/test_glasbey.py @@ -38,3 +38,12 @@ def test_glasbey_create_palette( grid_size=grid_size, cvd_severity=cvd_severity, ) + + +def test_glasbey_is_qualitative() -> None: + """Glasbey's palette is 256 maximally distinct categories, not a ramp.""" + from cmap import Colormap + + cm = Colormap("glasbey:glasbey") + assert cm.category == "qualitative" + assert cm.interpolation == "nearest"