File: test-viridis.R

package info (click to toggle)
r-cran-ggplot2 3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,748 kB
  • sloc: sh: 15; makefile: 5
file content (16 lines) | stat: -rw-r--r-- 527 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
df <- data_frame(x = 1, y = 1, z = "a", tier = factor("low", ordered = TRUE))

test_that("viridis scale changes point color", {
  p1 <- ggplot(df, aes(x, y, colour = z)) +
    geom_point()
  p2 <- p1 + scale_colour_viridis_d()

  expect_false(layer_data(p1)$colour == layer_data(p2)$colour)
  expect_equal(layer_data(p2)$colour, "#440154FF")
})

test_that("viridis scale is used by default for ordered factors", {
  p <- ggplot(df, aes(x, y, colour = tier)) + geom_point()

  expect_equal(layer_data(p)$colour, "#440154FF")
})