tests/testthat/test.stat_cdfinterval.R

# Tests for CDF bar plots
#
# Author: mjskay
###############################################################################

library(dplyr)



test_that("dodged ccdf barplots work", {
  skip_if_no_vdiffr()


  df = data.frame(
    y = 1:5,
    x = "a",
    g = "g1",
    stringsAsFactors = FALSE
  ) %>%
    rbind(data.frame(
      y = rep(1:5, each = 3) + 1:3,
      x = "b",
      g = c("g1", "g2", "g3"),
      stringsAsFactors = FALSE
    ))

  p = ggplot(df, aes(x = x, y = y))

  vdiffr::expect_doppelganger("vertical CCDF bar plot with dodging (3 groups)",
    p + stat_ccdfinterval(aes(fill = g), position = "dodge", n = 10)
  )

})

Try the ggdist package in your browser

Any scripts or data that you put into this service are public.

ggdist documentation built on July 4, 2024, 9:08 a.m.