Scales
Linear Scale
Three linear scales are used here: a scale by index for dots and
ticks along the x-axis, a scale for dots and ticks along
the y-axis, and a color scale for the dots' fill and stroke
style. The associated data is an array of numbers in the range [0, 100]. The
first example also demonstrates color derivation using per-channel
overrides.
Log Scale
Log scales support color ramps as well.
Diverging Scale
While domains and ranges for quantitative scales are normally uniform, you
can specify any number of contiguous regions. For example, for a diverging
color scale:
pv.Scale.linear(0, 10, 100).range("red", "yellow", "green")
While the domain is specified explicitly in this example, it could be
computed from the data if desired.
Of course, if we combine a log positional encoding with a log color
encoding, the ramp is now linear by position:
Ordinal Scale
Like the first example, three scales are used in this chart: an ordinal
scale for x, a linear scale for y, and an ordinal scale for
color. Now that ordinal scales can be used for categorical color encodings,
they may be able to subsume the current pv.Colors.
Notes
Examples:
pv.Scale.linear().range(0, Math.PI) // angle
pv.Scale.linear().range("red", "green") // quantitative colors
Note that for ordinal scales, the domain and range are discrete rather
than continuous:
pv.Scale.ordinal().domain("A", "B", "C", "D") // nominal domain
pv.Scale.ordinal().range("red", "green", "blue") // nominal colors