Skip to content
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

feat: Expand available {viridis} palettes in colorNumeric() #924

Merged
merged 4 commits into from
Jul 26, 2024

Conversation

jack-davison
Copy link
Contributor

@jack-davison jack-davison commented Jul 25, 2024

Since #897 {leaflet} uses {viridisLite}.

colorNumeric() only allows users to easily use four of the eight palettes available through {viridisLite}.

This PR allows the other four - turbo, mako, cividis, and rocket.

Slightly selfish PR in that I do like "turbo" for a not totally dreadful rainbow palette! Also I can't see a reason why only four of the eight palettes should be allowed / documented.

Minimal reproducible example

devtools::load_all()
#> ℹ Loading leaflet

pal <- colorNumeric("turbo", breweries91$founded)

leaflet(breweries91) |>
  addTiles() |>
  addCircleMarkers(color = ~ pal(founded)) |>
  addLegend(pal = pal,
            values = breweries91$founded)

Created on 2024-07-25 with reprex v2.1.0

PR task list:

  • Update NEWS
  • Update documentation with devtools::document()

No current tests for different viridisLite palettes, so no tests added.

@schloerke
Copy link
Contributor

Thank you!

@schloerke schloerke changed the title Expand available viridis palettes in colorNumeric() feat: Expand available {viridis} palettes in colorNumeric() Jul 26, 2024
@schloerke schloerke merged commit c4aec69 into rstudio:main Jul 26, 2024
12 checks passed
@jack-davison jack-davison deleted the feat/viridis-pals branch July 26, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants