tests/testthat/test-geom-polygon.R

context("geom-polygon")


# Visual tests ------------------------------------------------------------

test_that("geom_polygon draws correctly", {
  vdiffr::expect_doppelganger("stat_density2d with paths",
    ggplot(faithful, aes(x = eruptions, y = waiting)) +
      stat_density_2d(aes(colour = calc(level)), geom = "path") +
      xlim(0.5, 6) + ylim(40, 110)
  )
  vdiffr::expect_doppelganger("stat_density2d with filled polygons",
    ggplot(faithful, aes(x = eruptions, y = waiting)) +
      stat_density2d(aes(fill = calc(level)), geom = "polygon", colour = "white") +
      xlim(0.5, 6) + ylim(40, 110)
  )
})
SahaRahul/ggplot2 documentation built on May 17, 2019, 1:46 p.m.