Skip to content

Commit

Permalink
test for hammock plot
Browse files Browse the repository at this point in the history
  • Loading branch information
heike committed Jan 29, 2024
1 parent 4ac124d commit 36d6e8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Binary file added inst/titanic_hammock.rda
Binary file not shown.
15 changes: 15 additions & 0 deletions tests/testthat/test-ggparallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,19 @@ test_that("ggparallel works", {
# we have the right layer classes
expect_contains(classes, c("GeomRibbon", "GeomBar", "GeomText"))

# throw error
expect_message(expect_error(ggparallel(list("gear"), data=mtcars)))
})

test_that("ggparallel hammocks work", {
load(system.file("titanic_hammock.rda", package="ggparallel")) # loads object titanic_hammock

titanic <- as.data.frame(Titanic)
titanic_plot <- ggparallel(names(titanic)[c(1,4,2,3)], titanic, weight=1, asp=0.5,
method="hammock", ratio=0.2, order=c(0,0))
build_now <- ggplot2::ggplot_build(titanic_plot)
# titanic_hammock <- build_now$data
# save(titanic_hammock, file="inst/titanic_hammock.rda")

expect_identical(titanic_hammock, build_now$data)
})

0 comments on commit 36d6e8f

Please sign in to comment.