HMPlot

ordinal

A scale from ordered categories to colors along a colormap.

const rank = ordinal({ domain: ["Low", "Middle", "High"], colormap: "Viridis" });
<Points fill="rank" fillScale={rank} />

Parameters

domaincategory[]
The categories in order.
colormapstring | color[]
The colormap the categories are spread along (default Viridis).
rangecolor[]
Explicit colors instead of a colormap.
unknowncolor
The color of other categories.
labelstring
The legend's title.

Usage

Unlike an unordered categorical palette, an ordinal colormap communicates rank. Supply the category order explicitly; category values are not numerically interpolated.