{"id":107,"date":"2024-02-12T12:28:19","date_gmt":"2024-02-12T12:28:19","guid":{"rendered":"http:\/\/bentus\/?p=107"},"modified":"2024-07-24T10:37:21","modified_gmt":"2024-07-24T10:37:21","slug":"designing-2d-colormaps","status":"publish","type":"post","link":"http:\/\/bentus\/designing-2d-colormaps\/","title":{"rendered":"Designing 2D colormaps"},"content":{"rendered":"\n

Two dimensional colormaps are seeing use in a number of domains that rely upon python ecosystem. I work with dark-field X-ray microscopy, which is one such domain, but there are numerous others, such as astronomy, polarization microscopy etc. While each domain may have dedicated tooling, darfix<\/a>, astropy<\/a>, xrayutilities<\/a> etc, this tooling is built upon the scientific python stack, including numpy<\/a>, scipy<\/a>, pandas<\/a>, matplotlib<\/a>, plotly<\/a>, etc. Since these domains share common challenges regarding multivariate colormaps, it would be ideal to handle these challenges upstream (i.e. in matplotlib, plotly, etc.) rather than in the domain-specific packages. In addition to the technical implementation, the design criteria for multivariate colormaps must be explored.<\/p>\n\n\n\n\n\n\n\n

For the design of colormaps, Peter Kovesis<\/a> paper (2015) covers the topic with great diligence, as is Nathaniel Smith and St\u00e9fan van der Walts talk<\/a> (2015) explaining the origin of the now-ubiquitous (at least in academia) ‘viridis’ colormap. They outline an approach centered on human perception, where colormaps are designed to be perceptually uniform while maximizing the number of levels that can be distinguished. For multivariate colormaps, this approach has not previously been implemented.<\/p>\n\n\n\n

2D colormaps<\/strong>
Just as any continuous 1D colormap is a curve in colorspace, any continuous 2D colormap is a surface.
Peter Kovesis<\/a>, Nathaniel Smith and St\u00e9fan van der Walts <\/a>made the point that one should use a perceptually uniform colormap, such as CIELAB<\/a> when designing 1D colormaps, and this remains true for 2D colormaps. The sRBG color gamut is illustrated below in the colorspace CAM02-LCD (Large Color Difference) Luo et al. (2006)<\/a>.<\/p>\n\n\n\n