Replaced now-deprecated interpolate() and colorize() with shade(). #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Various people have found the names
interpolate()
andcolorize()
confusing, including me. Both of them could be called "colorize" in some sense, since both of them involve choosing a pixel color for each value in an aggregate array, and it's not clear to users why there are different functions for the two cases. To avoid confusion with the existing functioncolorize()
, it seems better to choose a new name for a combined function, andshade()
seems fitting given the name of this library and by analogy with 3D rendering/shading pipelines (where shading is the last step, as here).The initial commit also weakens checking of the
color_key
required for categorical aggregates. It now allows passing a long list of colors, to avoid having to pick precisely as many colors as categorical fields. I'll now make a list of suitable distinguishable colors to use as a default, so that people can easily visualize their aggregates using just "shade(agg)" regardless of whether the agg is 2D or 3D (categorical). There has already been a good bit of work on making nice lists of distinguishable colors, but what we need here is a list of distinguishable hues, and all the lists I've seen with more than 12 or so are using value (lightness or darkness) to help distinguish the colors, which we can't do here because we are using value to indicate the underlying data value (e.g. counts, in the census race example). So making a good list of hues isn't as simple as one might think, but it's definitely better to do it once as a default than to force every user to pick such a list themselves!