Skip to content

Commit fe680a8

Browse files
committed
add points to the density2d test
1 parent ffb7ac9 commit fe680a8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
context("Density2d")
22

33
# Draw a 2d density estimation using geom_density2d
4-
m <- ggplot(MASS::geyser) + geom_density2d(aes(x=duration, y=waiting))
4+
m <- ggplot(MASS::geyser, aes(x=duration, y=waiting)) +
5+
geom_point(alpha = 0.4) +
6+
geom_density2d()
57
L <- save_outputs(m, "density2d")
68

79
test_that("geom_density2d is translated to type=histogram2dcontour", {
8-
expect_equal(length(L$data), 1)
9-
expect_identical(L$data[[1]]$type, "histogram2dcontour")
10+
expect_equal(length(L$data), 2)
11+
expect_identical(L$data[[2]]$type, "histogram2dcontour")
1012
})
1113

1214
test_that("geom_density2d uses line contours by default", {
13-
expect_identical(L$data[[1]]$contours$coloring, "lines")
15+
expect_identical(L$data[[2]]$contours$coloring, "lines")
1416
})

0 commit comments

Comments
 (0)