-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port improvements to color mapping functions from leaflet #191
Conversation
3368bf2
to
ae0e520
Compare
Note the long comment on test-colors-advanced.r:118; this represents differing behavior from the original versions of these functions in leaflet.
@hadley I've implemented your suggestions. There's one significant difference in behavior between my Here's a demonstration of the differences: I thought I'd feel more strongly about the leaflet version being superior, but now looking at that link, I'm not sure it's that big of a deal either way. I do think that for Sequential/Blues the leaflet version looks better, and for Qualitative/Accent the scales version looks better. |
I don't feel particularly strongly, but I do think return the first two colours is more consistent that returning the first and the third. |
@hadley I'm fine with that. Let me know if you see anything else I need to change--otherwise I think it's done. |
col_numeric()
,col_bin()
,col_quantile()
, andcol_factor()
now supportviridis colors. Just pass a palette name (
"magma"
,"inferno"
,"plasma"
,or
"viridis"
) as thepalette
argument.col_numeric()
,col_bin()
,col_quantile()
, andcol_factor()
now have areverse
parameter, to apply color palettes in the opposite of their usualorder (i.e. high-to-low instead of low-to-high).
col_bin()
andcol_quantile()
now take aright
argument, which is passedto
base::cut()
; it indicates whether the bin/quantile intervals should beclosed on the right (and open on the left), or vice versa.
col_factor()
now tries to avoid interpolating qualitative RColorBrewerpalettes. Instead, it attempts to assign a palette color to each factor level.
Interpolation will still be used if there are more factor levels than
available colors, and a warning will be emitted in that case.