Skip to content

Commit 50e917a

Browse files
authored
Use rlang::hash instead of digest (#4853)
1 parent 2a13934 commit 50e917a

16 files changed

+216
-213
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Depends:
3131
R (>= 3.3)
3232
Imports:
3333
cli,
34-
digest,
3534
glue,
3635
grDevices,
3736
grid,

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ggplot2 (development version)
22

3+
* Use `rlang::hash()` instead of `digest::digest()`. This update may lead to
4+
changes in the automatic sorting of legends. In order to enforce a specific
5+
legend order use the `order` argument in the guide. (@thomasp85, #4458)
6+
37
* Fix various issues with how `labels`, `breaks`, `limits`, and `show.limits`
48
interact in the different binning guides (@thomasp85, #4831)
59

R/guide-bins.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ guide_train.bins <- function(guide, scale, aesthetic = NULL) {
209209
guide$key <- key
210210
guide$hash <- with(
211211
guide,
212-
digest::digest(list(title, key$.label, direction, name))
212+
hash(list(title, key$.label, direction, name))
213213
)
214214
guide
215215
}

R/guide-colorbar.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ guide_train.colorbar <- function(guide, scale, aesthetic = NULL) {
231231
guide$key <- guide$key[nrow(guide$key):1, ]
232232
guide$bar <- guide$bar[nrow(guide$bar):1, ]
233233
}
234-
guide$hash <- with(guide, digest::digest(list(title, key$.label, bar, name)))
234+
guide$hash <- with(guide, hash(list(title, key$.label, bar, name)))
235235
guide
236236
}
237237

R/guide-colorsteps.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ guide_train.colorsteps <- function(guide, scale, aesthetic = NULL) {
121121
guide$key <- guide$key[nrow(guide$key):1, ]
122122
guide$bar <- guide$bar[nrow(guide$bar):1, ]
123123
}
124-
guide$hash <- with(guide, digest::digest(list(title, key$.label, bar, name)))
124+
guide$hash <- with(guide, hash(list(title, key$.label, bar, name)))
125125
} else {
126126
guide <- NextMethod()
127127
limits <- scale$get_limits()

R/guide-legend.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ guide_train.legend <- function(guide, scale, aesthetic = NULL) {
227227
guide$key <- key
228228
guide$hash <- with(
229229
guide,
230-
digest::digest(list(title, key$.label, direction, name))
230+
hash(list(title, key$.label, direction, name))
231231
)
232232
guide
233233
}

R/guides-axis.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ guide_train.axis <- function(guide, scale, aesthetic = NULL) {
8989
}
9090

9191
guide$name <- paste0(guide$name, "_", aesthetic)
92-
guide$hash <- digest::digest(list(guide$title, guide$key$.value, guide$key$.label, guide$name))
92+
guide$hash <- hash(list(guide$title, guide$key$.value, guide$key$.label, guide$name))
9393
guide
9494
}
9595

tests/testthat/_snaps/draw-key/horizontal-boxplot-and-crossbar.svg

100755100644
Lines changed: 22 additions & 22 deletions
Loading

tests/testthat/_snaps/draw-key/horizontal-linerange-and-pointrange.svg

100755100644
Lines changed: 12 additions & 12 deletions
Loading

tests/testthat/_snaps/draw-key/rectangle-and-dotplot-key-glyphs.svg

Lines changed: 14 additions & 14 deletions
Loading

0 commit comments

Comments
 (0)