tests/testthat/test-stat-count.R

test_that("stat_count() checks the aesthetics", {
  p <- ggplot(mtcars) + stat_count()
  expect_snapshot_error(ggplot_build(p))
  p <- ggplot(mtcars) + stat_count(aes(factor(gear), mpg))
  expect_snapshot_error(ggplot_build(p))
})

Try the ggplot2 package in your browser

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

ggplot2 documentation built on Oct. 12, 2023, 5:08 p.m.