tests/testthat/test-pal_extender.R

test_that("pal_extender() works", {
  skip_if_not_installed("scales")
  pal <- scales::pal_brewer(palette = "PiYG")
  pal_e <- pal_extender(pal = pal)

  expect_equal(pal(5), pal_e(5))
  expect_false(any(is.na(pal_e(20))))
  expect_length(pal_e(20), 20L)
})

Try the ggstats package in your browser

Any scripts or data that you put into this service are public.

ggstats documentation built on April 12, 2025, 1:29 a.m.