File: test-stat-ellipsis.R

package info (click to toggle)
r-cran-ggplot2 3.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,748 kB
  • sloc: sh: 15; makefile: 5
file content (10 lines) | stat: -rw-r--r-- 381 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
test_that("stat_ellipsis returns correct data format", {
  n_seg <- 40
  d <- data_frame(x = c(1, 1, 4, 4, 4, 3, 3, 1), y = c(1:4, 1:4), id = rep(1:2, each = 4))
  p <- ggplot(d, aes(x = x, y = y, group = id)) +
    geom_point() +
    stat_ellipse(segments = n_seg)
  out <- layer_data(p, 2)
  expect_equal(nrow(out), (n_seg + 1) * 2)
  expect_equal(unique(out$group), c(1, 2))
})