tests/testthat/test-geom_y_margin_grob.R

context("geom_y_margin_grob")

p <- ggplot(mtcars, aes(wt, mpg)) +
  geom_point()

test_that("geom_y_margin_grob, missing yintercept", {
  p1 <- p + geom_y_margin_grob()
  result <- expect_error(layer_data(p1))
})

test_that("geom_y_margin_grob, not missing yintercept", {
  p1 <- p + geom_y_margin_grob(yintercept = 1)
  expect_no_error(layer_data(p1))
})

Try the ggpp package in your browser

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

ggpp documentation built on July 1, 2024, 9:07 a.m.