Skip to content

Prevent palette interpolation for some cases #149

Description

@EthanJantz

Generating a discrete color palette using cmap_*_discrete will interpolate colors from outside of a defined palette in cases where the number of colors used is less than the number of colors in the full palette. I think this is due to the use of grDevices::colorRampPalette as the palette function in colors_discrete.R. This interpolation is useful in cases where the number of colors needed is larger than the size of the palette or for continuous scales, but for cases where the number of colors needed is less we should expect that the palette function will simply pull from the palette in order, and not interpolate using grDevices::colorRampPalette. Below are the results of calling viz_palette on the "friday" palette for different values of num.

image

I'm unsure if this is intended behavior or not. @nmpeterson do you have any insight?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions