Skip to content

Use the full range of the palette for binned viridis #4737

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

Merged
merged 3 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@

* `geom_contour()` now accepts a function in the `breaks` argument (@eliocamp, #4652).

* VISUAL CHANGE: `scale_*_viridis_b()` now uses the full range of the viridis scales (@gregleleu, #4737)

* Updated documentation for `geom_contour()` to correctly reflect argument
precedence between `bins` and `binwidth`. (@eliocamp, #4651)

Expand Down
20 changes: 10 additions & 10 deletions R/scale-viridis.r
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ scale_colour_viridis_b <- function(..., alpha = 1, begin = 0, end = 1,
direction = 1, option = "D", values = NULL,
space = "Lab", na.value = "grey50",
guide = "coloursteps", aesthetics = "colour") {
pal <- binned_pal(
viridis_pal(alpha, begin, end, direction, option)
)

binned_scale(
aesthetics,
"viridis_b",
gradient_n_pal(
viridis_pal(alpha, begin, end, direction, option)(6),
values,
space
),
pal,
na.value = na.value,
guide = guide,
...
Expand All @@ -144,14 +144,14 @@ scale_fill_viridis_b <- function(..., alpha = 1, begin = 0, end = 1,
direction = 1, option = "D", values = NULL,
space = "Lab", na.value = "grey50",
guide = "coloursteps", aesthetics = "fill") {
pal <- binned_pal(
viridis_pal(alpha, begin, end, direction, option)
)

binned_scale(
aesthetics,
"viridis_b",
gradient_n_pal(
viridis_pal(alpha, begin, end, direction, option)(6),
values,
space
),
pal,
na.value = na.value,
guide = guide,
...
Expand Down