tests/testthat/test-compiler-geom-tile.R

context("geom_tile")

test_that("accepts width and height params", {
  df <- data.frame(x = c("a", "b"), y = c("a", "b"))

  out1 <- layer_data(ggplot(df, aes(x, y)) + geom_tile())
  expect_equal(out1$xmin, c(0.5, 1.5))
  expect_equal(out1$xmax, c(1.5, 2.5))

  out2 <- layer_data(ggplot(df, aes(x, y)) + geom_tile(width = 0.5, height = 0.5))
  expect_equal(out2$xmin, c(0.75, 1.75))
  expect_equal(out2$xmax, c(1.25, 2.25))
})

Try the animint2 package in your browser

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

animint2 documentation built on Nov. 22, 2023, 1:07 a.m.