tests/testthat/test-add-misc.R

test_that("add boxplot and violin works", {
  study |>
    tidyplot(x = treatment, y = score, color = treatment) |>
    add_boxplot() |>
    vdiffr::expect_doppelganger("boxplot", fig = _)

  study |>
    tidyplot(x = dose, y = score, color = group) |>
    add_boxplot() |>
    add_data_points_beeswarm() |>
    vdiffr::expect_doppelganger("boxplot grouped", fig = _)

  # violin plots fail on ci platforms
  # study |>
  #   tidyplot(x = treatment, y = score, color = treatment) |>
  #   add_violin() |>
  #   add_data_points_beeswarm() |>
  #   vdiffr::expect_doppelganger("violin", fig = _)
  #
  # study |>
  #   tidyplot(x = dose, y = score, color = group) |>
  #   add_violin() |>
  #   add_data_points_beeswarm() |>
  #   vdiffr::expect_doppelganger("violin grouped", fig = _)
})

Try the tidyplots package in your browser

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

tidyplots documentation built on April 3, 2025, 9:33 p.m.