Currently, only a few interpolated color schemes have discrete equivalents, and those that do have a limited number of possible ranges. For example, schemeYlGnBu offers discrete schemes only for lengths 3 through 9, and interpolateCool has no discrete scheme.
I've got a fairly simple function which could resolve this:
function buildDiscreteFromInterpolator(interpolator, count) {
const discrete = []
for (let i=0; i < count; i++) {
discrete.push(interpolator(i/count))
}
return discrete
}
but from a quick look at the source, I'm not sure where to put it for an actual PR. Or, if this function is a poor fit for the job for some reason I am unaware of, possibly suggest an alternative?
Currently, only a few interpolated color schemes have discrete equivalents, and those that do have a limited number of possible ranges. For example,
schemeYlGnBu
offers discrete schemes only for lengths 3 through 9, andinterpolateCool
has no discrete scheme.I've got a fairly simple function which could resolve this:
but from a quick look at the source, I'm not sure where to put it for an actual PR. Or, if this function is a poor fit for the job for some reason I am unaware of, possibly suggest an alternative?