Debian Codegraph @

tests/testthat/test-4-clusterplots.R

raw
1
2 test_that("dendrogram plots", {
3 skip_if_not_installed("ggplot2")
4 require(ggplot2, quietly = TRUE)
5 hc <- hclust(dist(USArrests), "ave")
6 hcdata <- dendro_data(hc, type = "rectangle")
7 p <- ggplot() +
8 geom_segment(data = segment(hcdata), aes(x = x0, y = y0, xend = x1, yend = y1)) +
9 geom_text(data = label(hcdata), aes(x = x, y = y, label = text)) +
10 coord_flip() +
11 scale_y_reverse(expand = c(0.2, 0))
12 expect_s3_class(p, "ggplot")
13 })