Skip to content

graphic regressions

Mara Averick edited this page Nov 2, 2018 · 2 revisions

Note: The ggplot2 wiki is no longer maintained, please use the ggplot2 website instead!

Regression tests for graphics

Options for output:

  • Rdata containing grid grobs (one per expectation? or test? or context? or package?)
  • Raster image: png
  • Vector image: pdf/svg

Probably best to store as grid grobs (because has the most information), but if different, display a diff on the binary images (as that's the simplest to calculate and visualise)

Need way to initialise, to say that this graphic looks ok. Also need way to reset - to say that this change is ok, it's not an important difference or it is as expected.

expect_unchanged(name, object)

  • name needs to be package unique
  • as_expected(name, cache_path)

expect_graphic_unchanged(name, plot)

  • if there is a difference, displays in some way - html?

Note: The ggplot2 wiki is no longer maintained, please use the ggplot2 website instead!

Clone this wiki locally