Skip to content

Support sequential (✅), divergent, and cyclic colormaps #881

@mfisher87

Description

@mfisher87

Use case

Eventually users will want to use colormaps to display data with multiple critical values. Sequential colormaps have two critical values: the minimum and the maximum. For example, viridis transitions from low-lightness to high-lightness. Currently we only support sequential colormaps (plus rainbow/jet, which is kind of a special case with implicit critical values that actually distort the perception of the underlying data).

A divergent colormap has a critical value in the center, many times that's 0, and the extremes diverge from that value, e.g. "balance":

Image

Cyclical colormaps are... cyclical! They begin and end with the same value (e.g. 0 degrees is the same direction as 360 degrees), e.g. "phase":

Image

Preferred solution

Prioritize divergent colormaps, as that's a much more common use case than cyclical.

Support a new "type" attribute for colormaps so our code can tell the difference for the purpose of displaying tick marks on legends (#880) -- divergent colormaps need a tick mark at the critical value (usually in the center), and sequential ones don't.

Enable users to set a minimum and maximum value for the colormap to interpolate across, this way divergent colormaps can be calibrated with 0 (or whatever the critical value is) in the middle (#137).

Think about the "mode" field for divergent colormaps. Quantiles, for example, can pull the distribution towards one side and misalign the critical value. Not sure off the top of my head what the best solution for this is.

For legends, display the critical values in the legend. For sequential colormaps, we only need to display the minimum and maximum. For divergent, we need to display the central critical value too. For cyclical... 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions