Skip to content

Commit 96d5337

Browse files
author
Anthony Chiu
committed
Fix tidyverse#2429. Minor changes to NEWS update and formatting
1 parent d1cb617 commit 96d5337

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

NEWS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@
8484

8585
* Increase the default `nbin` of `guide_colourbar()` to place the ticks more precisely (#3508, @yutannihilation).
8686

87-
* Modified `manual_scale` to match `values` with the order of `breaks` whenever
88-
`values` is an unnamed vector. Previously, unnamed `values` would be matched
89-
to the limits of the scale and ignore the order of any `breaks` provided. Note
90-
that this may change the appearance of plots that previously relied on the
91-
unordered behaviour. (#2429, @idno0001)
87+
* Modified `manual_scale()` to match `values` with the order of `breaks`
88+
whenever `values` is an unnamed vector. Previously, unnamed `values` would
89+
match with the limits of the scale and ignore the order of any `breaks`
90+
provided. Note that this may change the appearance of plots that previously
91+
relied on the unordered behaviour (#2429, @idno0001).
9292

9393
# ggplot2 3.2.1
9494

tests/testthat/test-scale-manual.r

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,19 @@ test_that("generic scale can be used in place of aesthetic-specific scales", {
6969
})
7070

7171
test_that("named values do not match with breaks in manual scales", {
72-
s <- scale_fill_manual(values = c("data_red" = "red", "data_black" = "black"),
73-
breaks = c("data_black", "data_red"))
74-
s$train(c("data_black", "data_red"))
75-
expect_equal(s$map(c("data_red", "data_black")), c("red", "black"))
72+
s <- scale_fill_manual(
73+
values = c("data_red" = "red", "data_black" = "black"),
74+
breaks = c("data_black", "data_red")
75+
)
76+
s$train(c("data_black", "data_red"))
77+
expect_equal(s$map(c("data_red", "data_black")), c("red", "black"))
7678
})
7779

7880
test_that("unnamed values match breaks in manual scales", {
79-
s <- scale_fill_manual(values = c("red", "black"),
80-
breaks = c("data_red", "data_black"))
81-
s$train(c("data_red", "data_black"))
82-
expect_equal(s$map(c("data_red", "data_black")), c("red", "black"))
81+
s <- scale_fill_manual(
82+
values = c("red", "black"),
83+
breaks = c("data_red", "data_black")
84+
)
85+
s$train(c("data_red", "data_black"))
86+
expect_equal(s$map(c("data_red", "data_black")), c("red", "black"))
8387
})

0 commit comments

Comments
 (0)