Skip to content

Commit 99149fc

Browse files
authored
Use the full range of the palette for binned viridis (#4737)
1 parent 819d014 commit 99149fc

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090

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

93+
* VISUAL CHANGE: `scale_*_viridis_b()` now uses the full range of the viridis scales (@gregleleu, #4737)
94+
9395
* Updated documentation for `geom_contour()` to correctly reflect argument
9496
precedence between `bins` and `binwidth`. (@eliocamp, #4651)
9597

R/scale-viridis.r

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ scale_colour_viridis_b <- function(..., alpha = 1, begin = 0, end = 1,
124124
direction = 1, option = "D", values = NULL,
125125
space = "Lab", na.value = "grey50",
126126
guide = "coloursteps", aesthetics = "colour") {
127+
pal <- binned_pal(
128+
viridis_pal(alpha, begin, end, direction, option)
129+
)
130+
127131
binned_scale(
128132
aesthetics,
129133
"viridis_b",
130-
gradient_n_pal(
131-
viridis_pal(alpha, begin, end, direction, option)(6),
132-
values,
133-
space
134-
),
134+
pal,
135135
na.value = na.value,
136136
guide = guide,
137137
...
@@ -144,14 +144,14 @@ scale_fill_viridis_b <- function(..., alpha = 1, begin = 0, end = 1,
144144
direction = 1, option = "D", values = NULL,
145145
space = "Lab", na.value = "grey50",
146146
guide = "coloursteps", aesthetics = "fill") {
147+
pal <- binned_pal(
148+
viridis_pal(alpha, begin, end, direction, option)
149+
)
150+
147151
binned_scale(
148152
aesthetics,
149153
"viridis_b",
150-
gradient_n_pal(
151-
viridis_pal(alpha, begin, end, direction, option)(6),
152-
values,
153-
space
154-
),
154+
pal,
155155
na.value = na.value,
156156
guide = guide,
157157
...

0 commit comments

Comments
 (0)