File: test-scale-brewer.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 (15 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
test_that("mid-point in diverging brewer color scale", {
  d <- data_frame(x = -1:1)

  p <- ggplot(d) +
    aes(x = x, y = 1, color = x) +
    scale_color_distiller(palette = 'RdBu', direction = 1, limits = c(-1, 1))

  expect_equal(layer_data(p)$colour, c("#B2182B", "#F7F7F7", "#2166AC"))

  p <- ggplot(d) +
    aes(x = x, y = 1, fill = x) +
    scale_fill_distiller(palette = 'RdBu', direction = 1, limits = c(-1, 1))

  expect_equal(layer_data(p)$fill, c("#B2182B", "#F7F7F7", "#2166AC"))
})