diff --git a/.travis.yml b/.travis.yml
index 3bc552597..38df63579 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,13 @@ language: R
cache: packages
sudo: false
+addons:
+ apt:
+ sources:
+ - debian-sid
+ packages:
+ - libfreetype6
+
r_github_packages:
- hadley/staticdocs@old
diff --git a/DESCRIPTION b/DESCRIPTION
index cc3e5deaa..9b16ee69c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -36,6 +36,7 @@ Suggests:
multcomp,
nlme,
testthat (>= 0.11.0),
+ vdiffr,
quantreg,
knitr,
rpart,
@@ -217,3 +218,4 @@ Collate:
'zzz.r'
VignetteBuilder: knitr
RoxygenNote: 6.0.0
+Remotes: hadley/svglite
diff --git a/NAMESPACE b/NAMESPACE
index 6d81e98fa..b4d883ec5 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -476,6 +476,7 @@ export(theme_linedraw)
export(theme_minimal)
export(theme_replace)
export(theme_set)
+export(theme_test)
export(theme_update)
export(theme_void)
export(transform_position)
diff --git a/NEWS.md b/NEWS.md
index 6e77f4749..f027966dc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,7 @@
# ggplot2 2.2.1.9000
+* Automatic visual unit tests with vdiffr.
+
* Layers no longer warn about unknown aesthetics who's value is set to
`NULL` (overriding a set aesthetic in the plot) (#1909).
diff --git a/R/theme-defaults.r b/R/theme-defaults.r
index 579197ed4..bf6976eb2 100644
--- a/R/theme-defaults.r
+++ b/R/theme-defaults.r
@@ -40,6 +40,10 @@
#' \item{\code{theme_void}}{
#' A completely empty theme.}
#'
+#' \item{\code{theme_test}}{
+#' A theme for visual unit tests. It should ideally never change except
+#' for new features.}
+#'
#' }
#'
#' @examples
@@ -341,3 +345,110 @@ theme_void <- function(base_size = 11, base_family = "") {
)
}
+#' @export
+#' @rdname ggtheme
+theme_test <- function(base_size = 11, base_family = "") {
+ half_line <- base_size / 2
+
+ theme(
+ line = element_line(colour = "black", size = 0.5, linetype = 1,
+ lineend = "butt"),
+ rect = element_rect(fill = "white", colour = "black",
+ size = 0.5, linetype = 1),
+ text = element_text(
+ family = base_family, face = "plain",
+ colour = "black", size = base_size,
+ lineheight = 0.9, hjust = 0.5, vjust = 0.5, angle = 0,
+ margin = margin(), debug = FALSE
+ ),
+
+ axis.line = element_blank(),
+ axis.line.x = NULL,
+ axis.line.y = NULL,
+ axis.text = element_text(size = rel(0.8), colour = "grey30"),
+ axis.text.x = element_text(margin = margin(t = 0.8 * half_line / 2), vjust = 1),
+ axis.text.x.top = element_text(margin = margin(b = 0.8 * half_line / 2), vjust = 0),
+ axis.text.y = element_text(margin = margin(r = 0.8 * half_line / 2), hjust = 1),
+ axis.text.y.right = element_text(margin = margin(l = 0.8 * half_line / 2), hjust = 0),
+ axis.ticks = element_line(colour = "grey20"),
+ axis.ticks.length = unit(half_line / 2, "pt"),
+ axis.title.x = element_text(
+ margin = margin(t = half_line),
+ vjust = 1
+ ),
+ axis.title.x.top = element_text(
+ margin = margin(b = half_line),
+ vjust = 0
+ ),
+ axis.title.y = element_text(
+ angle = 90,
+ margin = margin(r = half_line),
+ vjust = 1
+ ),
+ axis.title.y.right = element_text(
+ angle = -90,
+ margin = margin(l = half_line),
+ vjust = 0
+ ),
+
+ legend.background = element_rect(colour = NA),
+ legend.spacing = unit(0.4, "cm"),
+ legend.spacing.x = NULL,
+ legend.spacing.y = NULL,
+ legend.margin = margin(0, 0, 0, 0, "cm"),
+ legend.key = element_rect(fill = "white", colour=NA),
+ legend.key.size = unit(1.2, "lines"),
+ legend.key.height = NULL,
+ legend.key.width = NULL,
+ legend.text = element_text(size = rel(0.8)),
+ legend.text.align = NULL,
+ legend.title = element_text(hjust = 0),
+ legend.title.align = NULL,
+ legend.position = "right",
+ legend.direction = NULL,
+ legend.justification = "center",
+ legend.box = NULL,
+ legend.box.margin = margin(0, 0, 0, 0, "cm"),
+ legend.box.background = element_blank(),
+ legend.box.spacing = unit(0.4, "cm"),
+
+ panel.background = element_rect(fill = "white", colour = NA),
+ panel.border = element_rect(fill = NA, colour = "grey20"),
+ panel.grid.major = element_blank(),
+ panel.grid.minor = element_blank(),
+ panel.spacing = unit(half_line, "pt"),
+ panel.spacing.x = NULL,
+ panel.spacing.y = NULL,
+ panel.ontop = FALSE,
+
+ strip.background = element_rect(fill = "grey85", colour = "grey20"),
+ strip.text = element_text(colour = "grey10", size = rel(0.8)),
+ strip.text.x = element_text(margin = margin(t = half_line, b = half_line)),
+ strip.text.y = element_text(angle = -90, margin = margin(l = half_line, r = half_line)),
+ strip.placement = "inside",
+ strip.placement.x = NULL,
+ strip.placement.y = NULL,
+ strip.switch.pad.grid = unit(0.1, "cm"),
+ strip.switch.pad.wrap = unit(0.1, "cm"),
+
+ plot.background = element_rect(colour = "white"),
+ plot.title = element_text(
+ size = rel(1.2),
+ hjust = 0, vjust = 1,
+ margin = margin(b = half_line * 1.2)
+ ),
+ plot.subtitle = element_text(
+ size = rel(0.9),
+ hjust = 0, vjust = 1,
+ margin = margin(b = half_line * 0.9)
+ ),
+ plot.caption = element_text(
+ size = rel(0.9),
+ hjust = 1, vjust = 1,
+ margin = margin(t = half_line * 0.9)
+ ),
+ plot.margin = margin(half_line, half_line, half_line, half_line),
+
+ complete = TRUE
+ )
+}
diff --git a/appveyor.yml b/appveyor.yml
index e32d316cc..51d2ba55a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -12,6 +12,10 @@ install:
# Adapt as necessary starting from here
+environment:
+ global:
+ USE_RTOOLS: true
+
build_script:
- travis-tool.sh install_deps
diff --git a/man/ggtheme.Rd b/man/ggtheme.Rd
index 08c0af4dc..2791e7074 100644
--- a/man/ggtheme.Rd
+++ b/man/ggtheme.Rd
@@ -10,6 +10,7 @@
\alias{theme_minimal}
\alias{theme_classic}
\alias{theme_void}
+\alias{theme_test}
\title{Complete themes}
\usage{
theme_grey(base_size = 11, base_family = "")
@@ -29,6 +30,8 @@ theme_minimal(base_size = 11, base_family = "")
theme_classic(base_size = 11, base_family = "")
theme_void(base_size = 11, base_family = "")
+
+theme_test(base_size = 11, base_family = "")
}
\arguments{
\item{base_size}{base font size}
@@ -73,6 +76,10 @@ A classic-looking theme, with x and y axis lines and no gridlines.}
\item{\code{theme_void}}{
A completely empty theme.}
+\item{\code{theme_test}}{
+A theme for visual unit tests. It should ideally never change except
+for new features.}
+
}
}
\examples{
diff --git a/tests/figs/cartesian-coordinates/contract-range.svg b/tests/figs/cartesian-coordinates/contract-range.svg
new file mode 100644
index 000000000..260311abd
--- /dev/null
+++ b/tests/figs/cartesian-coordinates/contract-range.svg
@@ -0,0 +1,69 @@
+
+
diff --git a/tests/figs/cartesian-coordinates/expand-range.svg b/tests/figs/cartesian-coordinates/expand-range.svg
new file mode 100644
index 000000000..57c054985
--- /dev/null
+++ b/tests/figs/cartesian-coordinates/expand-range.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/coord-map/aitoff-projection-custom-orientation-centered-on-date-line.svg b/tests/figs/coord-map/aitoff-projection-custom-orientation-centered-on-date-line.svg
new file mode 100644
index 000000000..85f8260c4
--- /dev/null
+++ b/tests/figs/coord-map/aitoff-projection-custom-orientation-centered-on-date-line.svg
@@ -0,0 +1,1026 @@
+
+
diff --git a/tests/figs/coord-map/aitoff-projection-default-orientation.svg b/tests/figs/coord-map/aitoff-projection-default-orientation.svg
new file mode 100644
index 000000000..ceeb56eda
--- /dev/null
+++ b/tests/figs/coord-map/aitoff-projection-default-orientation.svg
@@ -0,0 +1,1698 @@
+
+
diff --git a/tests/figs/coord-map/mercator-projection.svg b/tests/figs/coord-map/mercator-projection.svg
new file mode 100644
index 000000000..bdf3114ea
--- /dev/null
+++ b/tests/figs/coord-map/mercator-projection.svg
@@ -0,0 +1,1656 @@
+
+
diff --git a/tests/figs/coord-map/no-projection.svg b/tests/figs/coord-map/no-projection.svg
new file mode 100644
index 000000000..2c2957912
--- /dev/null
+++ b/tests/figs/coord-map/no-projection.svg
@@ -0,0 +1,1672 @@
+
+
diff --git a/tests/figs/coord-map/ortho-projection-custom-orientation-centered-on-new-york.svg b/tests/figs/coord-map/ortho-projection-custom-orientation-centered-on-new-york.svg
new file mode 100644
index 000000000..e08479cd1
--- /dev/null
+++ b/tests/figs/coord-map/ortho-projection-custom-orientation-centered-on-new-york.svg
@@ -0,0 +1,954 @@
+
+
diff --git a/tests/figs/coord-map/ortho-projection-default-orientation-centered-on-north-pole.svg b/tests/figs/coord-map/ortho-projection-default-orientation-centered-on-north-pole.svg
new file mode 100644
index 000000000..06f03c72e
--- /dev/null
+++ b/tests/figs/coord-map/ortho-projection-default-orientation-centered-on-north-pole.svg
@@ -0,0 +1,1183 @@
+
+
diff --git a/tests/figs/coord-map/usa-map-mercator-projection.svg b/tests/figs/coord-map/usa-map-mercator-projection.svg
new file mode 100644
index 000000000..7a8d86068
--- /dev/null
+++ b/tests/figs/coord-map/usa-map-mercator-projection.svg
@@ -0,0 +1,122 @@
+
+
diff --git a/tests/figs/coord-polar/concentric-circles-at-theta-1-80-100.svg b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-100.svg
new file mode 100644
index 000000000..762fdfbda
--- /dev/null
+++ b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-100.svg
@@ -0,0 +1,133 @@
+
+
diff --git a/tests/figs/coord-polar/concentric-circles-at-theta-1-80-40.svg b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-40.svg
new file mode 100644
index 000000000..316877c09
--- /dev/null
+++ b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-40.svg
@@ -0,0 +1,133 @@
+
+
diff --git a/tests/figs/coord-polar/concentric-circles-at-theta-1-80-80.svg b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-80.svg
new file mode 100644
index 000000000..0abb57a88
--- /dev/null
+++ b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-80.svg
@@ -0,0 +1,133 @@
+
+
diff --git a/tests/figs/coord-polar/concentric-circles-at-theta-1-80-mult-100.svg b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-mult-100.svg
new file mode 100644
index 000000000..932324cdc
--- /dev/null
+++ b/tests/figs/coord-polar/concentric-circles-at-theta-1-80-mult-100.svg
@@ -0,0 +1,133 @@
+
+
diff --git a/tests/figs/coord-polar/concentric-circles-at-theta-1-80.svg b/tests/figs/coord-polar/concentric-circles-at-theta-1-80.svg
new file mode 100644
index 000000000..7212738a2
--- /dev/null
+++ b/tests/figs/coord-polar/concentric-circles-at-theta-1-80.svg
@@ -0,0 +1,133 @@
+
+
diff --git a/tests/figs/coord-polar/continuous-theta-has-merged-low-high-values.svg b/tests/figs/coord-polar/continuous-theta-has-merged-low-high-values.svg
new file mode 100644
index 000000000..6cbcfb7a1
--- /dev/null
+++ b/tests/figs/coord-polar/continuous-theta-has-merged-low-high-values.svg
@@ -0,0 +1,64 @@
+
+
diff --git a/tests/figs/coord-polar/continuous-theta-with-xlim-0-6-and-ylim-0-16.svg b/tests/figs/coord-polar/continuous-theta-with-xlim-0-6-and-ylim-0-16.svg
new file mode 100644
index 000000000..f3eb4deec
--- /dev/null
+++ b/tests/figs/coord-polar/continuous-theta-with-xlim-0-6-and-ylim-0-16.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/coord-polar/racetrack-plot-with-expand-f-closed-and-no-center-hole.svg b/tests/figs/coord-polar/racetrack-plot-with-expand-f-closed-and-no-center-hole.svg
new file mode 100644
index 000000000..d4ef8c857
--- /dev/null
+++ b/tests/figs/coord-polar/racetrack-plot-with-expand-f-closed-and-no-center-hole.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/coord-polar/racetrack-plot-with-expand-t-closed-and-has-center-hole.svg b/tests/figs/coord-polar/racetrack-plot-with-expand-t-closed-and-has-center-hole.svg
new file mode 100644
index 000000000..c8bf27ff0
--- /dev/null
+++ b/tests/figs/coord-polar/racetrack-plot-with-expand-t-closed-and-has-center-hole.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/coord-polar/rays-circular-arcs-and-spiral-arcs.svg b/tests/figs/coord-polar/rays-circular-arcs-and-spiral-arcs.svg
new file mode 100644
index 000000000..85f4ce152
--- /dev/null
+++ b/tests/figs/coord-polar/rays-circular-arcs-and-spiral-arcs.svg
@@ -0,0 +1,361 @@
+
+
diff --git a/tests/figs/coord-polar/rose-plot-with-has-equal-spacing.svg b/tests/figs/coord-polar/rose-plot-with-has-equal-spacing.svg
new file mode 100644
index 000000000..f563370e8
--- /dev/null
+++ b/tests/figs/coord-polar/rose-plot-with-has-equal-spacing.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/alpha-set-in-alpha.svg b/tests/figs/creating-aesthetic-mappings/alpha-set-in-alpha.svg
new file mode 100644
index 000000000..ac9087c01
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/alpha-set-in-alpha.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/alpha-set-in-colour.svg b/tests/figs/creating-aesthetic-mappings/alpha-set-in-colour.svg
new file mode 100644
index 000000000..48ff82300
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/alpha-set-in-colour.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/stat-count-width-0-5.svg b/tests/figs/creating-aesthetic-mappings/stat-count-width-0-5.svg
new file mode 100644
index 000000000..b169b3b58
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/stat-count-width-0-5.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/stat-count.svg b/tests/figs/creating-aesthetic-mappings/stat-count.svg
new file mode 100644
index 000000000..34c6abc05
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/stat-count.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/stat-identity-width-0-5.svg b/tests/figs/creating-aesthetic-mappings/stat-identity-width-0-5.svg
new file mode 100644
index 000000000..a50a57313
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/stat-identity-width-0-5.svg
@@ -0,0 +1,48 @@
+
+
diff --git a/tests/figs/creating-aesthetic-mappings/stat-identity.svg b/tests/figs/creating-aesthetic-mappings/stat-identity.svg
new file mode 100644
index 000000000..1548dcfae
--- /dev/null
+++ b/tests/figs/creating-aesthetic-mappings/stat-identity.svg
@@ -0,0 +1,48 @@
+
+
diff --git a/tests/figs/deps.txt b/tests/figs/deps.txt
new file mode 100644
index 000000000..c65b888a3
--- /dev/null
+++ b/tests/figs/deps.txt
@@ -0,0 +1,3 @@
+vdiffr: 0.1.1
+svglite: 1.2.0.9000
+ggplot2: 2.2.1.9000
diff --git a/tests/figs/geom-boxplot/outlier-colours.svg b/tests/figs/geom-boxplot/outlier-colours.svg
new file mode 100644
index 000000000..caa96cbae
--- /dev/null
+++ b/tests/figs/geom-boxplot/outlier-colours.svg
@@ -0,0 +1,84 @@
+
+
diff --git a/tests/figs/geom-dotplot/2-na-values-bin-along-y-stack-center.svg b/tests/figs/geom-dotplot/2-na-values-bin-along-y-stack-center.svg
new file mode 100644
index 000000000..358d5dc76
--- /dev/null
+++ b/tests/figs/geom-dotplot/2-na-values-bin-along-y-stack-center.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/tests/figs/geom-dotplot/2-na-values-dot-density-binning-binwidth-4.svg b/tests/figs/geom-dotplot/2-na-values-dot-density-binning-binwidth-4.svg
new file mode 100644
index 000000000..515afde79
--- /dev/null
+++ b/tests/figs/geom-dotplot/2-na-values-dot-density-binning-binwidth-4.svg
@@ -0,0 +1,69 @@
+
+
diff --git a/tests/figs/geom-dotplot/basic-dotplot-with-dot-density-binning-binwidth-4.svg b/tests/figs/geom-dotplot/basic-dotplot-with-dot-density-binning-binwidth-4.svg
new file mode 100644
index 000000000..d9a77b3c7
--- /dev/null
+++ b/tests/figs/geom-dotplot/basic-dotplot-with-dot-density-binning-binwidth-4.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-along-y-stack-center.svg b/tests/figs/geom-dotplot/bin-along-y-stack-center.svg
new file mode 100644
index 000000000..fa459cb31
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-along-y-stack-center.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole-histodot.svg b/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole-histodot.svg
new file mode 100644
index 000000000..dde05346b
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole-histodot.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole.svg b/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole.svg
new file mode 100644
index 000000000..4d2af3edc
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-along-y-stack-centerwhole.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-continous-x-axis-grouping-by-x.svg b/tests/figs/geom-dotplot/bin-y-continous-x-axis-grouping-by-x.svg
new file mode 100644
index 000000000..e7f1ddecd
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-continous-x-axis-grouping-by-x.svg
@@ -0,0 +1,137 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-continous-x-axis-single-x-group.svg b/tests/figs/geom-dotplot/bin-y-continous-x-axis-single-x-group.svg
new file mode 100644
index 000000000..f835a1760
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-continous-x-axis-single-x-group.svg
@@ -0,0 +1,137 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-dodged-coord-flip.svg b/tests/figs/geom-dotplot/bin-y-dodged-coord-flip.svg
new file mode 100644
index 000000000..9be66b32c
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-dodged-coord-flip.svg
@@ -0,0 +1,160 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-dodged.svg b/tests/figs/geom-dotplot/bin-y-dodged.svg
new file mode 100644
index 000000000..0763fd9e5
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-dodged.svg
@@ -0,0 +1,160 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-dodging-3-stackgroups-histodot-currently-broken.svg b/tests/figs/geom-dotplot/bin-y-dodging-3-stackgroups-histodot-currently-broken.svg
new file mode 100644
index 000000000..6163c3a80
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-dodging-3-stackgroups-histodot-currently-broken.svg
@@ -0,0 +1,145 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-across-groups.svg b/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-across-groups.svg
new file mode 100644
index 000000000..70446c170
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-across-groups.svg
@@ -0,0 +1,137 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-coord-flip.svg b/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-coord-flip.svg
new file mode 100644
index 000000000..2abca4547
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-three-x-groups-bins-aligned-coord-flip.svg
@@ -0,0 +1,137 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-three-x-groups-fill-and-dodge.svg b/tests/figs/geom-dotplot/bin-y-three-x-groups-fill-and-dodge.svg
new file mode 100644
index 000000000..e1de89391
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-three-x-groups-fill-and-dodge.svg
@@ -0,0 +1,163 @@
+
+
diff --git a/tests/figs/geom-dotplot/bin-y-three-x-groups-stack-centerwhole.svg b/tests/figs/geom-dotplot/bin-y-three-x-groups-stack-centerwhole.svg
new file mode 100644
index 000000000..a35a7d5ff
--- /dev/null
+++ b/tests/figs/geom-dotplot/bin-y-three-x-groups-stack-centerwhole.svg
@@ -0,0 +1,137 @@
+
+
diff --git a/tests/figs/geom-dotplot/dots-stacked-closer-stackratio-5-fill-white.svg b/tests/figs/geom-dotplot/dots-stacked-closer-stackratio-5-fill-white.svg
new file mode 100644
index 000000000..bdf582994
--- /dev/null
+++ b/tests/figs/geom-dotplot/dots-stacked-closer-stackratio-5-fill-white.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/facets-3-groups-histodot-stackgroups.svg b/tests/figs/geom-dotplot/facets-3-groups-histodot-stackgroups.svg
new file mode 100644
index 000000000..e2dce891b
--- /dev/null
+++ b/tests/figs/geom-dotplot/facets-3-groups-histodot-stackgroups.svg
@@ -0,0 +1,229 @@
+
+
diff --git a/tests/figs/geom-dotplot/histodot-binning-equal-bin-spacing.svg b/tests/figs/geom-dotplot/histodot-binning-equal-bin-spacing.svg
new file mode 100644
index 000000000..01cec8ed7
--- /dev/null
+++ b/tests/figs/geom-dotplot/histodot-binning-equal-bin-spacing.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/larger-dots-dotsize-1-5-fill-white.svg b/tests/figs/geom-dotplot/larger-dots-dotsize-1-5-fill-white.svg
new file mode 100644
index 000000000..30982f745
--- /dev/null
+++ b/tests/figs/geom-dotplot/larger-dots-dotsize-1-5-fill-white.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/multiple-groups-bins-aligned.svg b/tests/figs/geom-dotplot/multiple-groups-bins-aligned.svg
new file mode 100644
index 000000000..b68b59a8e
--- /dev/null
+++ b/tests/figs/geom-dotplot/multiple-groups-bins-aligned.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/geom-dotplot/multiple-groups-bins-not-aligned.svg b/tests/figs/geom-dotplot/multiple-groups-bins-not-aligned.svg
new file mode 100644
index 000000000..f5ca3ba4e
--- /dev/null
+++ b/tests/figs/geom-dotplot/multiple-groups-bins-not-aligned.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-center-with-coord-flip.svg b/tests/figs/geom-dotplot/stack-center-with-coord-flip.svg
new file mode 100644
index 000000000..27a74457f
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-center-with-coord-flip.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-center.svg b/tests/figs/geom-dotplot/stack-center.svg
new file mode 100644
index 000000000..6a8ed9db3
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-center.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-centerwhole-with-coord-flip.svg b/tests/figs/geom-dotplot/stack-centerwhole-with-coord-flip.svg
new file mode 100644
index 000000000..a344b0d12
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-centerwhole-with-coord-flip.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-centerwhole.svg b/tests/figs/geom-dotplot/stack-centerwhole.svg
new file mode 100644
index 000000000..a261f3588
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-centerwhole.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-down-with-coord-flip.svg b/tests/figs/geom-dotplot/stack-down-with-coord-flip.svg
new file mode 100644
index 000000000..edaaef78a
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-down-with-coord-flip.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-down.svg b/tests/figs/geom-dotplot/stack-down.svg
new file mode 100644
index 000000000..74080d9b8
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-down.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-up-with-coord-flip.svg b/tests/figs/geom-dotplot/stack-up-with-coord-flip.svg
new file mode 100644
index 000000000..89fadfd8a
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-up-with-coord-flip.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stack-up.svg b/tests/figs/geom-dotplot/stack-up.svg
new file mode 100644
index 000000000..ccd7f9c77
--- /dev/null
+++ b/tests/figs/geom-dotplot/stack-up.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-dotplot/stackgroups-with-3-groups-bin-y-histodot.svg b/tests/figs/geom-dotplot/stackgroups-with-3-groups-bin-y-histodot.svg
new file mode 100644
index 000000000..bbe28beed
--- /dev/null
+++ b/tests/figs/geom-dotplot/stackgroups-with-3-groups-bin-y-histodot.svg
@@ -0,0 +1,150 @@
+
+
diff --git a/tests/figs/geom-dotplot/stackgroups-with-3-groups-dot-density-with-aligned-bins.svg b/tests/figs/geom-dotplot/stackgroups-with-3-groups-dot-density-with-aligned-bins.svg
new file mode 100644
index 000000000..81a42bd7a
--- /dev/null
+++ b/tests/figs/geom-dotplot/stackgroups-with-3-groups-dot-density-with-aligned-bins.svg
@@ -0,0 +1,152 @@
+
+
diff --git a/tests/figs/geom-dotplot/stackgroups-with-3-groups-histodot.svg b/tests/figs/geom-dotplot/stackgroups-with-3-groups-histodot.svg
new file mode 100644
index 000000000..544b2b62f
--- /dev/null
+++ b/tests/figs/geom-dotplot/stackgroups-with-3-groups-histodot.svg
@@ -0,0 +1,152 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-0-slope-1-aligns-with-bars.svg b/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-0-slope-1-aligns-with-bars.svg
new file mode 100644
index 000000000..f1b1dd775
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-0-slope-1-aligns-with-bars.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-2-slope-0.svg b/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-2-slope-0.svg
new file mode 100644
index 000000000..40a731efc
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-coord-flip-int-2-slope-0.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-int-0-slope-1-aligns-with-bars.svg b/tests/figs/geom-hline-vline-abline/geom-abline-int-0-slope-1-aligns-with-bars.svg
new file mode 100644
index 000000000..98d7e3bd3
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-int-0-slope-1-aligns-with-bars.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-azequalarea.svg b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-azequalarea.svg
new file mode 100644
index 000000000..5963b1533
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-azequalarea.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-cylindrical.svg b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-cylindrical.svg
new file mode 100644
index 000000000..72f61a258
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-cylindrical.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-mercator.svg b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-mercator.svg
new file mode 100644
index 000000000..89eafa5cf
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-int-130-slope-1-proj-mercator.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-abline-int-2-slope-0.svg b/tests/figs/geom-hline-vline-abline/geom-abline-int-2-slope-0.svg
new file mode 100644
index 000000000..ac7b5d7b5
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-abline-int-2-slope-0.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-coord-flip-intercept-2.svg b/tests/figs/geom-hline-vline-abline/geom-hline-coord-flip-intercept-2.svg
new file mode 100644
index 000000000..1327f2124
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-coord-flip-intercept-2.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-coord-polar-int-2-expect-circle-at-r-2.svg b/tests/figs/geom-hline-vline-abline/geom-hline-coord-polar-int-2-expect-circle-at-r-2.svg
new file mode 100644
index 000000000..4a11a5e99
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-coord-polar-int-2-expect-circle-at-r-2.svg
@@ -0,0 +1,64 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-azequalarea.svg b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-azequalarea.svg
new file mode 100644
index 000000000..37379bab0
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-azequalarea.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-cylindrical.svg b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-cylindrical.svg
new file mode 100644
index 000000000..42d332d6e
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-cylindrical.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-mercator.svg b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-mercator.svg
new file mode 100644
index 000000000..5a6bbbb77
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-int-45-proj-mercator.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-hline-intercept-2.svg b/tests/figs/geom-hline-vline-abline/geom-hline-intercept-2.svg
new file mode 100644
index 000000000..70d6ef8ba
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-hline-intercept-2.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-coord-flip-intercept-2.svg b/tests/figs/geom-hline-vline-abline/geom-vline-coord-flip-intercept-2.svg
new file mode 100644
index 000000000..6a7945866
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-coord-flip-intercept-2.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-coord-polar-int-2-expect-a-ray-at-2.svg b/tests/figs/geom-hline-vline-abline/geom-vline-coord-polar-int-2-expect-a-ray-at-2.svg
new file mode 100644
index 000000000..33b545ebe
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-coord-polar-int-2-expect-a-ray-at-2.svg
@@ -0,0 +1,64 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-azequalara.svg b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-azequalara.svg
new file mode 100644
index 000000000..9f57801b9
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-azequalara.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-cylindrical.svg b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-cylindrical.svg
new file mode 100644
index 000000000..c3450a825
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-cylindrical.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-mercator.svg b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-mercator.svg
new file mode 100644
index 000000000..f0a293b4b
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-int-172-proj-mercator.svg
@@ -0,0 +1,76 @@
+
+
diff --git a/tests/figs/geom-hline-vline-abline/geom-vline-intercept-2.svg b/tests/figs/geom-hline-vline-abline/geom-vline-intercept-2.svg
new file mode 100644
index 000000000..214964369
--- /dev/null
+++ b/tests/figs/geom-hline-vline-abline/geom-vline-intercept-2.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-path/lines-colour-with-changed-data-order-should-have-same-appearance.svg b/tests/figs/geom-path/lines-colour-with-changed-data-order-should-have-same-appearance.svg
new file mode 100644
index 000000000..5ece938fb
--- /dev/null
+++ b/tests/figs/geom-path/lines-colour-with-changed-data-order-should-have-same-appearance.svg
@@ -0,0 +1,81 @@
+
+
diff --git a/tests/figs/geom-path/lines-colour.svg b/tests/figs/geom-path/lines-colour.svg
new file mode 100644
index 000000000..89bb206ab
--- /dev/null
+++ b/tests/figs/geom-path/lines-colour.svg
@@ -0,0 +1,81 @@
+
+
diff --git a/tests/figs/geom-path/lines-with-changed-data-order-should-have-same-appearance.svg b/tests/figs/geom-path/lines-with-changed-data-order-should-have-same-appearance.svg
new file mode 100644
index 000000000..64716fd1e
--- /dev/null
+++ b/tests/figs/geom-path/lines-with-changed-data-order-should-have-same-appearance.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/figs/geom-path/lines.svg b/tests/figs/geom-path/lines.svg
new file mode 100644
index 000000000..94a1b8284
--- /dev/null
+++ b/tests/figs/geom-path/lines.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/figs/geom-polygon/stat-density2d-with-filled-polygons.svg b/tests/figs/geom-polygon/stat-density2d-with-filled-polygons.svg
new file mode 100644
index 000000000..5128eda39
--- /dev/null
+++ b/tests/figs/geom-polygon/stat-density2d-with-filled-polygons.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/geom-polygon/stat-density2d-with-paths.svg b/tests/figs/geom-polygon/stat-density2d-with-paths.svg
new file mode 100644
index 000000000..96e378850
--- /dev/null
+++ b/tests/figs/geom-polygon/stat-density2d-with-paths.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/geom-raster/1-x-3-just-0-0.svg b/tests/figs/geom-raster/1-x-3-just-0-0.svg
new file mode 100644
index 000000000..1a3296247
--- /dev/null
+++ b/tests/figs/geom-raster/1-x-3-just-0-0.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-raster/1-x-3-set-limits.svg b/tests/figs/geom-raster/1-x-3-set-limits.svg
new file mode 100644
index 000000000..7d06d20f0
--- /dev/null
+++ b/tests/figs/geom-raster/1-x-3-set-limits.svg
@@ -0,0 +1,73 @@
+
+
diff --git a/tests/figs/geom-raster/1-x-3.svg b/tests/figs/geom-raster/1-x-3.svg
new file mode 100644
index 000000000..dd034f427
--- /dev/null
+++ b/tests/figs/geom-raster/1-x-3.svg
@@ -0,0 +1,69 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-1-just-0-0.svg b/tests/figs/geom-raster/3-x-1-just-0-0.svg
new file mode 100644
index 000000000..9a1c04407
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-1-just-0-0.svg
@@ -0,0 +1,71 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-1-set-limits.svg b/tests/figs/geom-raster/3-x-1-set-limits.svg
new file mode 100644
index 000000000..fe1062e49
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-1-set-limits.svg
@@ -0,0 +1,73 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-1.svg b/tests/figs/geom-raster/3-x-1.svg
new file mode 100644
index 000000000..433d0886d
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-1.svg
@@ -0,0 +1,69 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-2-just-0-0.svg b/tests/figs/geom-raster/3-x-2-just-0-0.svg
new file mode 100644
index 000000000..7e0764d8b
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-2-just-0-0.svg
@@ -0,0 +1,77 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-2-set-limits.svg b/tests/figs/geom-raster/3-x-2-set-limits.svg
new file mode 100644
index 000000000..f8663b7c5
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-2-set-limits.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/geom-raster/3-x-2.svg b/tests/figs/geom-raster/3-x-2.svg
new file mode 100644
index 000000000..5f5369e9f
--- /dev/null
+++ b/tests/figs/geom-raster/3-x-2.svg
@@ -0,0 +1,75 @@
+
+
diff --git a/tests/figs/geom-raster/irregular-categorical.svg b/tests/figs/geom-raster/irregular-categorical.svg
new file mode 100644
index 000000000..231f64819
--- /dev/null
+++ b/tests/figs/geom-raster/irregular-categorical.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/geom-violin/basic.svg b/tests/figs/geom-violin/basic.svg
new file mode 100644
index 000000000..6e4d9edca
--- /dev/null
+++ b/tests/figs/geom-violin/basic.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/geom-violin/continuous-x-axis-multiple-groups-center-should-be-at-2-0.svg b/tests/figs/geom-violin/continuous-x-axis-multiple-groups-center-should-be-at-2-0.svg
new file mode 100644
index 000000000..2626429b4
--- /dev/null
+++ b/tests/figs/geom-violin/continuous-x-axis-multiple-groups-center-should-be-at-2-0.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/geom-violin/continuous-x-axis-single-group-center-should-be-at-1-0.svg b/tests/figs/geom-violin/continuous-x-axis-single-group-center-should-be-at-1-0.svg
new file mode 100644
index 000000000..35bd7968a
--- /dev/null
+++ b/tests/figs/geom-violin/continuous-x-axis-single-group-center-should-be-at-1-0.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/geom-violin/coord-flip.svg b/tests/figs/geom-violin/coord-flip.svg
new file mode 100644
index 000000000..4728b2b40
--- /dev/null
+++ b/tests/figs/geom-violin/coord-flip.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/geom-violin/coord-polar.svg b/tests/figs/geom-violin/coord-polar.svg
new file mode 100644
index 000000000..6490d6ca7
--- /dev/null
+++ b/tests/figs/geom-violin/coord-polar.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/geom-violin/dodging-and-coord-flip.svg b/tests/figs/geom-violin/dodging-and-coord-flip.svg
new file mode 100644
index 000000000..bdfab0787
--- /dev/null
+++ b/tests/figs/geom-violin/dodging-and-coord-flip.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/figs/geom-violin/dodging.svg b/tests/figs/geom-violin/dodging.svg
new file mode 100644
index 000000000..132a4ad61
--- /dev/null
+++ b/tests/figs/geom-violin/dodging.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/figs/geom-violin/grouping-on-x-and-fill-dodge-width-0-5.svg b/tests/figs/geom-violin/grouping-on-x-and-fill-dodge-width-0-5.svg
new file mode 100644
index 000000000..bd9f15670
--- /dev/null
+++ b/tests/figs/geom-violin/grouping-on-x-and-fill-dodge-width-0-5.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/tests/figs/geom-violin/grouping-on-x-and-fill.svg b/tests/figs/geom-violin/grouping-on-x-and-fill.svg
new file mode 100644
index 000000000..f107310cf
--- /dev/null
+++ b/tests/figs/geom-violin/grouping-on-x-and-fill.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/tests/figs/geom-violin/narrower-width-5.svg b/tests/figs/geom-violin/narrower-width-5.svg
new file mode 100644
index 000000000..63e15c9c3
--- /dev/null
+++ b/tests/figs/geom-violin/narrower-width-5.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/geom-violin/quantiles.svg b/tests/figs/geom-violin/quantiles.svg
new file mode 100644
index 000000000..445aadb06
--- /dev/null
+++ b/tests/figs/geom-violin/quantiles.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/tests/figs/geom-violin/scale-area-to-sample-size-c-is-smaller.svg b/tests/figs/geom-violin/scale-area-to-sample-size-c-is-smaller.svg
new file mode 100644
index 000000000..c43edfce0
--- /dev/null
+++ b/tests/figs/geom-violin/scale-area-to-sample-size-c-is-smaller.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/geom-violin/with-smaller-bandwidth-and-points.svg b/tests/figs/geom-violin/with-smaller-bandwidth-and-points.svg
new file mode 100644
index 000000000..29279bc51
--- /dev/null
+++ b/tests/figs/geom-violin/with-smaller-bandwidth-and-points.svg
@@ -0,0 +1,129 @@
+
+
diff --git a/tests/figs/geom-violin/with-tails-and-points.svg b/tests/figs/geom-violin/with-tails-and-points.svg
new file mode 100644
index 000000000..53a294af8
--- /dev/null
+++ b/tests/figs/geom-violin/with-tails-and-points.svg
@@ -0,0 +1,125 @@
+
+
diff --git a/tests/figs/guides/align-facet-labels-facets-horizontal.svg b/tests/figs/guides/align-facet-labels-facets-horizontal.svg
new file mode 100644
index 000000000..df65cb3f8
--- /dev/null
+++ b/tests/figs/guides/align-facet-labels-facets-horizontal.svg
@@ -0,0 +1,695 @@
+
+
diff --git a/tests/figs/guides/align-facet-labels-facets-vertical.svg b/tests/figs/guides/align-facet-labels-facets-vertical.svg
new file mode 100644
index 000000000..d6b38f016
--- /dev/null
+++ b/tests/figs/guides/align-facet-labels-facets-vertical.svg
@@ -0,0 +1,695 @@
+
+
diff --git a/tests/figs/guides/facet-grid-legend-on-bottom.svg b/tests/figs/guides/facet-grid-legend-on-bottom.svg
new file mode 100644
index 000000000..e25392ae1
--- /dev/null
+++ b/tests/figs/guides/facet-grid-legend-on-bottom.svg
@@ -0,0 +1,173 @@
+
+
diff --git a/tests/figs/guides/facet-grid-legend-on-left.svg b/tests/figs/guides/facet-grid-legend-on-left.svg
new file mode 100644
index 000000000..97b2b7ae3
--- /dev/null
+++ b/tests/figs/guides/facet-grid-legend-on-left.svg
@@ -0,0 +1,173 @@
+
+
diff --git a/tests/figs/guides/facet-grid-legend-on-right.svg b/tests/figs/guides/facet-grid-legend-on-right.svg
new file mode 100644
index 000000000..f03b24578
--- /dev/null
+++ b/tests/figs/guides/facet-grid-legend-on-right.svg
@@ -0,0 +1,173 @@
+
+
diff --git a/tests/figs/guides/facet-grid-legend-on-top.svg b/tests/figs/guides/facet-grid-legend-on-top.svg
new file mode 100644
index 000000000..fa2ec3bf9
--- /dev/null
+++ b/tests/figs/guides/facet-grid-legend-on-top.svg
@@ -0,0 +1,173 @@
+
+
diff --git a/tests/figs/guides/facet-wrap-legend-on-bottom.svg b/tests/figs/guides/facet-wrap-legend-on-bottom.svg
new file mode 100644
index 000000000..64369dafc
--- /dev/null
+++ b/tests/figs/guides/facet-wrap-legend-on-bottom.svg
@@ -0,0 +1,261 @@
+
+
diff --git a/tests/figs/guides/facet-wrap-legend-on-left.svg b/tests/figs/guides/facet-wrap-legend-on-left.svg
new file mode 100644
index 000000000..a2a5b6c3a
--- /dev/null
+++ b/tests/figs/guides/facet-wrap-legend-on-left.svg
@@ -0,0 +1,261 @@
+
+
diff --git a/tests/figs/guides/facet-wrap-legend-on-right.svg b/tests/figs/guides/facet-wrap-legend-on-right.svg
new file mode 100644
index 000000000..e47024ab2
--- /dev/null
+++ b/tests/figs/guides/facet-wrap-legend-on-right.svg
@@ -0,0 +1,261 @@
+
+
diff --git a/tests/figs/guides/facet-wrap-legend-on-top.svg b/tests/figs/guides/facet-wrap-legend-on-top.svg
new file mode 100644
index 000000000..842ad6fa7
--- /dev/null
+++ b/tests/figs/guides/facet-wrap-legend-on-top.svg
@@ -0,0 +1,261 @@
+
+
diff --git a/tests/figs/guides/legend-inside-plot-bottom-left-of-legend-at-center.svg b/tests/figs/guides/legend-inside-plot-bottom-left-of-legend-at-center.svg
new file mode 100644
index 000000000..44ba65dcb
--- /dev/null
+++ b/tests/figs/guides/legend-inside-plot-bottom-left-of-legend-at-center.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/guides/legend-inside-plot-bottom-left.svg b/tests/figs/guides/legend-inside-plot-bottom-left.svg
new file mode 100644
index 000000000..0f4a5d70a
--- /dev/null
+++ b/tests/figs/guides/legend-inside-plot-bottom-left.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/guides/legend-inside-plot-centered.svg b/tests/figs/guides/legend-inside-plot-centered.svg
new file mode 100644
index 000000000..e9f431fc7
--- /dev/null
+++ b/tests/figs/guides/legend-inside-plot-centered.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/guides/legend-inside-plot-top-right.svg b/tests/figs/guides/legend-inside-plot-top-right.svg
new file mode 100644
index 000000000..22c5bb1e9
--- /dev/null
+++ b/tests/figs/guides/legend-inside-plot-top-right.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/guides/legend-on-bottom.svg b/tests/figs/guides/legend-on-bottom.svg
new file mode 100644
index 000000000..6c17e49a0
--- /dev/null
+++ b/tests/figs/guides/legend-on-bottom.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/guides/legend-on-left.svg b/tests/figs/guides/legend-on-left.svg
new file mode 100644
index 000000000..d45c083b0
--- /dev/null
+++ b/tests/figs/guides/legend-on-left.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/guides/legend-on-right.svg b/tests/figs/guides/legend-on-right.svg
new file mode 100644
index 000000000..385848d3b
--- /dev/null
+++ b/tests/figs/guides/legend-on-right.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/guides/legend-on-top.svg b/tests/figs/guides/legend-on-top.svg
new file mode 100644
index 000000000..f80031245
--- /dev/null
+++ b/tests/figs/guides/legend-on-top.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/guides/padding-in-legend-box.svg b/tests/figs/guides/padding-in-legend-box.svg
new file mode 100644
index 000000000..cbe5ab119
--- /dev/null
+++ b/tests/figs/guides/padding-in-legend-box.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/tests/figs/guides/thick-axis-lines.svg b/tests/figs/guides/thick-axis-lines.svg
new file mode 100644
index 000000000..aa9de126e
--- /dev/null
+++ b/tests/figs/guides/thick-axis-lines.svg
@@ -0,0 +1,85 @@
+
+
diff --git a/tests/figs/scale-date/dates-along-x-default-breaks.svg b/tests/figs/scale-date/dates-along-x-default-breaks.svg
new file mode 100644
index 000000000..bce350ec4
--- /dev/null
+++ b/tests/figs/scale-date/dates-along-x-default-breaks.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scale-date/dates-along-y-default-breaks.svg b/tests/figs/scale-date/dates-along-y-default-breaks.svg
new file mode 100644
index 000000000..1bf749993
--- /dev/null
+++ b/tests/figs/scale-date/dates-along-y-default-breaks.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scale-date/scale-x-date-breaks-3-weeks.svg b/tests/figs/scale-date/scale-x-date-breaks-3-weeks.svg
new file mode 100644
index 000000000..da94f05c2
--- /dev/null
+++ b/tests/figs/scale-date/scale-x-date-breaks-3-weeks.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/scale-date/scale-x-date-breaks-date-breaks-2-weeks.svg b/tests/figs/scale-date/scale-x-date-breaks-date-breaks-2-weeks.svg
new file mode 100644
index 000000000..3e190a899
--- /dev/null
+++ b/tests/figs/scale-date/scale-x-date-breaks-date-breaks-2-weeks.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/tests/figs/scale-date/scale-x-date-labels-date-format-m-d.svg b/tests/figs/scale-date/scale-x-date-labels-date-format-m-d.svg
new file mode 100644
index 000000000..43173aca8
--- /dev/null
+++ b/tests/figs/scale-date/scale-x-date-labels-date-format-m-d.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scale-date/scale-x-date-labels-date-format-w-week.svg b/tests/figs/scale-date/scale-x-date-labels-date-format-w-week.svg
new file mode 100644
index 000000000..61d1524d9
--- /dev/null
+++ b/tests/figs/scale-date/scale-x-date-labels-date-format-w-week.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scale-date/scale-y-date-breaks-3-weeks.svg b/tests/figs/scale-date/scale-y-date-breaks-3-weeks.svg
new file mode 100644
index 000000000..bb49545e7
--- /dev/null
+++ b/tests/figs/scale-date/scale-y-date-breaks-3-weeks.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/scale-date/scale-y-date-breaks-date-breaks-2-weeks.svg b/tests/figs/scale-date/scale-y-date-breaks-date-breaks-2-weeks.svg
new file mode 100644
index 000000000..75de3bd34
--- /dev/null
+++ b/tests/figs/scale-date/scale-y-date-breaks-date-breaks-2-weeks.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/default-breaks.svg b/tests/figs/scales-breaks-and-labels/default-breaks.svg
new file mode 100644
index 000000000..81f736fa3
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/default-breaks.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/manual-minor-breaks-with-coord-polar.svg b/tests/figs/scales-breaks-and-labels/manual-minor-breaks-with-coord-polar.svg
new file mode 100644
index 000000000..34027f260
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/manual-minor-breaks-with-coord-polar.svg
@@ -0,0 +1,52 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/manual-minor-breaks.svg b/tests/figs/scales-breaks-and-labels/manual-minor-breaks.svg
new file mode 100644
index 000000000..fe55b5d42
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/manual-minor-breaks.svg
@@ -0,0 +1,46 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks-coord-polar.svg b/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks-coord-polar.svg
new file mode 100644
index 000000000..d112210ff
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks-coord-polar.svg
@@ -0,0 +1,51 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks.svg b/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks.svg
new file mode 100644
index 000000000..7cdb508e2
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/months-and-weeks-breaks.svg
@@ -0,0 +1,50 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-alpha-breaks-no-legend.svg b/tests/figs/scales-breaks-and-labels/no-alpha-breaks-no-legend.svg
new file mode 100644
index 000000000..692df025c
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-alpha-breaks-no-legend.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-colour-breaks-no-legend.svg b/tests/figs/scales-breaks-and-labels/no-colour-breaks-no-legend.svg
new file mode 100644
index 000000000..d5729c9bf
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-colour-breaks-no-legend.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-fill-breaks-no-legend.svg b/tests/figs/scales-breaks-and-labels/no-fill-breaks-no-legend.svg
new file mode 100644
index 000000000..bd54cedb1
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-fill-breaks-no-legend.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-size-breaks-no-legend.svg b/tests/figs/scales-breaks-and-labels/no-size-breaks-no-legend.svg
new file mode 100644
index 000000000..141fbb3a3
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-size-breaks-no-legend.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-x-breaks.svg b/tests/figs/scales-breaks-and-labels/no-x-breaks.svg
new file mode 100644
index 000000000..d978a1873
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-x-breaks.svg
@@ -0,0 +1,44 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/no-y-breaks.svg b/tests/figs/scales-breaks-and-labels/no-y-breaks.svg
new file mode 100644
index 000000000..a92e90cfc
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/no-y-breaks.svg
@@ -0,0 +1,44 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/scale-x-continuous-trans-log2-trans-scale-y-log10.svg b/tests/figs/scales-breaks-and-labels/scale-x-continuous-trans-log2-trans-scale-y-log10.svg
new file mode 100644
index 000000000..a2d826285
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/scale-x-continuous-trans-log2-trans-scale-y-log10.svg
@@ -0,0 +1,10041 @@
+
+
diff --git a/tests/figs/scales-breaks-and-labels/x-and-y-transformations.svg b/tests/figs/scales-breaks-and-labels/x-and-y-transformations.svg
new file mode 100644
index 000000000..26a1ced21
--- /dev/null
+++ b/tests/figs/scales-breaks-and-labels/x-and-y-transformations.svg
@@ -0,0 +1,64 @@
+
+
diff --git a/tests/figs/stat-sum/summary-with-color-and-lines.svg b/tests/figs/stat-sum/summary-with-color-and-lines.svg
new file mode 100644
index 000000000..d470c2d2f
--- /dev/null
+++ b/tests/figs/stat-sum/summary-with-color-and-lines.svg
@@ -0,0 +1,97 @@
+
+
diff --git a/tests/figs/stat-sum/summary-with-crossbars-manual-grouping.svg b/tests/figs/stat-sum/summary-with-crossbars-manual-grouping.svg
new file mode 100644
index 000000000..c53fea4c4
--- /dev/null
+++ b/tests/figs/stat-sum/summary-with-crossbars-manual-grouping.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/tests/figs/stat-sum/summary-with-crossbars-no-grouping.svg b/tests/figs/stat-sum/summary-with-crossbars-no-grouping.svg
new file mode 100644
index 000000000..8117005db
--- /dev/null
+++ b/tests/figs/stat-sum/summary-with-crossbars-no-grouping.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/tests/figs/themes/add-blue-and-italic-in-separate-element-objects.svg b/tests/figs/themes/add-blue-and-italic-in-separate-element-objects.svg
new file mode 100644
index 000000000..81fcc00a1
--- /dev/null
+++ b/tests/figs/themes/add-blue-and-italic-in-separate-element-objects.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/themes/add-blue-and-italic-in-single-element-object.svg b/tests/figs/themes/add-blue-and-italic-in-single-element-object.svg
new file mode 100644
index 000000000..2045db867
--- /dev/null
+++ b/tests/figs/themes/add-blue-and-italic-in-single-element-object.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/tests/figs/themes/add-blue-saved-theme-object-and-theme-bw-expect-black-text.svg b/tests/figs/themes/add-blue-saved-theme-object-and-theme-bw-expect-black-text.svg
new file mode 100644
index 000000000..9bd945ef6
--- /dev/null
+++ b/tests/figs/themes/add-blue-saved-theme-object-and-theme-bw-expect-black-text.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/add-saved-theme-object-with-theme-bw-plus-blue-text.svg b/tests/figs/themes/add-saved-theme-object-with-theme-bw-plus-blue-text.svg
new file mode 100644
index 000000000..fb50647ce
--- /dev/null
+++ b/tests/figs/themes/add-saved-theme-object-with-theme-bw-plus-blue-text.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/add-theme-bw-base-size-24-base-family-serif.svg b/tests/figs/themes/add-theme-bw-base-size-24-base-family-serif.svg
new file mode 100644
index 000000000..9449fa8de
--- /dev/null
+++ b/tests/figs/themes/add-theme-bw-base-size-24-base-family-serif.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/axis-title-text-is-blue-compounded-relative-sizing.svg b/tests/figs/themes/axis-title-text-is-blue-compounded-relative-sizing.svg
new file mode 100644
index 000000000..2a921308b
--- /dev/null
+++ b/tests/figs/themes/axis-title-text-is-blue-compounded-relative-sizing.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/blue-text-plus-theme-bw-result-is-black-text.svg b/tests/figs/themes/blue-text-plus-theme-bw-result-is-black-text.svg
new file mode 100644
index 000000000..e6694424e
--- /dev/null
+++ b/tests/figs/themes/blue-text-plus-theme-bw-result-is-black-text.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/height-is-3-times-width-2-column-facets.svg b/tests/figs/themes/height-is-3-times-width-2-column-facets.svg
new file mode 100644
index 000000000..2d9543272
--- /dev/null
+++ b/tests/figs/themes/height-is-3-times-width-2-column-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/height-is-3-times-width-2-row-facets.svg b/tests/figs/themes/height-is-3-times-width-2-row-facets.svg
new file mode 100644
index 000000000..506be57b8
--- /dev/null
+++ b/tests/figs/themes/height-is-3-times-width-2-row-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/height-is-3-times-width-2-wrap-facets.svg b/tests/figs/themes/height-is-3-times-width-2-wrap-facets.svg
new file mode 100644
index 000000000..0ee392ba1
--- /dev/null
+++ b/tests/figs/themes/height-is-3-times-width-2-wrap-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/height-is-3-times-width-2x2-facets.svg b/tests/figs/themes/height-is-3-times-width-2x2-facets.svg
new file mode 100644
index 000000000..cffa4def5
--- /dev/null
+++ b/tests/figs/themes/height-is-3-times-width-2x2-facets.svg
@@ -0,0 +1,165 @@
+
+
diff --git a/tests/figs/themes/height-is-3-times-width.svg b/tests/figs/themes/height-is-3-times-width.svg
new file mode 100644
index 000000000..4e20e34c9
--- /dev/null
+++ b/tests/figs/themes/height-is-3-times-width.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/tests/figs/themes/many-blank-items-and-light-blue-plot-background.svg b/tests/figs/themes/many-blank-items-and-light-blue-plot-background.svg
new file mode 100644
index 000000000..6a0966f87
--- /dev/null
+++ b/tests/figs/themes/many-blank-items-and-light-blue-plot-background.svg
@@ -0,0 +1,32 @@
+
+
diff --git a/tests/figs/themes/text-is-element-blank-result-is-no-text.svg b/tests/figs/themes/text-is-element-blank-result-is-no-text.svg
new file mode 100644
index 000000000..b105e0c21
--- /dev/null
+++ b/tests/figs/themes/text-is-element-blank-result-is-no-text.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/figs/themes/theme-bw-larger-relative-size-for-axis-title-y.svg b/tests/figs/themes/theme-bw-larger-relative-size-for-axis-title-y.svg
new file mode 100644
index 000000000..17e4c5f04
--- /dev/null
+++ b/tests/figs/themes/theme-bw-larger-relative-size-for-axis-title-y.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/theme-bw-plus-blue-text.svg b/tests/figs/themes/theme-bw-plus-blue-text.svg
new file mode 100644
index 000000000..d45d193c8
--- /dev/null
+++ b/tests/figs/themes/theme-bw-plus-blue-text.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/theme-bw-replace-larger-relative-size-for-axis-title-y.svg b/tests/figs/themes/theme-bw-replace-larger-relative-size-for-axis-title-y.svg
new file mode 100644
index 000000000..ee7809be8
--- /dev/null
+++ b/tests/figs/themes/theme-bw-replace-larger-relative-size-for-axis-title-y.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/tests/figs/themes/width-is-3-times-height-2-column-facets.svg b/tests/figs/themes/width-is-3-times-height-2-column-facets.svg
new file mode 100644
index 000000000..05037599b
--- /dev/null
+++ b/tests/figs/themes/width-is-3-times-height-2-column-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/width-is-3-times-height-2-row-facets.svg b/tests/figs/themes/width-is-3-times-height-2-row-facets.svg
new file mode 100644
index 000000000..8960fc993
--- /dev/null
+++ b/tests/figs/themes/width-is-3-times-height-2-row-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/width-is-3-times-height-2-wrap-facets.svg b/tests/figs/themes/width-is-3-times-height-2-wrap-facets.svg
new file mode 100644
index 000000000..f9c7acfe9
--- /dev/null
+++ b/tests/figs/themes/width-is-3-times-height-2-wrap-facets.svg
@@ -0,0 +1,109 @@
+
+
diff --git a/tests/figs/themes/width-is-3-times-height-2x2-facets.svg b/tests/figs/themes/width-is-3-times-height-2x2-facets.svg
new file mode 100644
index 000000000..14d981a9c
--- /dev/null
+++ b/tests/figs/themes/width-is-3-times-height-2x2-facets.svg
@@ -0,0 +1,165 @@
+
+
diff --git a/tests/figs/themes/width-is-3-times-height.svg b/tests/figs/themes/width-is-3-times-height.svg
new file mode 100644
index 000000000..243560d67
--- /dev/null
+++ b/tests/figs/themes/width-is-3-times-height.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/tests/testthat/helper-vdiffr.R b/tests/testthat/helper-vdiffr.R
new file mode 100644
index 000000000..18a3c1d3e
--- /dev/null
+++ b/tests/testthat/helper-vdiffr.R
@@ -0,0 +1,2 @@
+
+theme_set(theme_test())
diff --git a/tests/testthat/test-aes.r b/tests/testthat/test-aes.r
index 10396a60b..d948d11a7 100644
--- a/tests/testthat/test-aes.r
+++ b/tests/testthat/test-aes.r
@@ -58,3 +58,32 @@ test_that("aes evaluated in environment where plot created", {
}
expect_equal(layer_data(f())$x, 10)
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("aesthetics are drawn correctly", {
+ dat <- data.frame(xvar = letters[1:3], yvar = 7:9)
+
+ vdiffr::expect_doppelganger("stat='identity'",
+ ggplot(dat, aes(x = xvar, y = yvar)) + geom_bar(stat = "identity")
+ )
+ vdiffr::expect_doppelganger("stat='identity', width=0.5",
+ ggplot(dat, aes(x = xvar, y = yvar)) + geom_bar(stat = "identity", width = 0.5)
+ )
+ vdiffr::expect_doppelganger("stat='count'",
+ ggplot(dat, aes(x = xvar)) + geom_bar(stat = "count")
+ )
+ vdiffr::expect_doppelganger("stat='count', width=0.5",
+ ggplot(dat, aes(x = xvar)) + geom_bar(stat = "count", width = 0.5)
+ )
+})
+
+test_that("alpha is drawn correctly", {
+ vdiffr::expect_doppelganger("Alpha set in colour",
+ qplot(1, 1, color = I("#cc000044"), size = I(50))
+ )
+ vdiffr::expect_doppelganger("Alpha set in alpha",
+ qplot(1, 1, color = I("#cc0000"), size = I(50), alpha = I(0.27))
+ )
+})
diff --git a/tests/testthat/test-coord-cartesian.R b/tests/testthat/test-coord-cartesian.R
new file mode 100644
index 000000000..b3e1b3a04
--- /dev/null
+++ b/tests/testthat/test-coord-cartesian.R
@@ -0,0 +1,15 @@
+context("Cartesian coordinates")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("cartesian coords draws correctly with limits", {
+ p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
+
+ vdiffr::expect_doppelganger("expand range",
+ p + coord_cartesian(xlim = c(0, 10), ylim = c(0, 50))
+ )
+ vdiffr::expect_doppelganger("contract range",
+ p + coord_cartesian(xlim = c(2, 4), ylim = c(20, 40))
+ )
+})
diff --git a/tests/testthat/test-coord-map.R b/tests/testthat/test-coord-map.R
new file mode 100644
index 000000000..3dd8da72c
--- /dev/null
+++ b/tests/testthat/test-coord-map.R
@@ -0,0 +1,50 @@
+context("coord-map")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("maps draws correctly", {
+ library(maps)
+
+ # World map
+ world_map <- map_data("world")
+ pworld <- ggplot(world_map, aes(x = long, y = lat, group = group)) +
+ geom_polygon()
+
+
+ vdiffr::expect_doppelganger("no projection",
+ pworld
+ )
+ vdiffr::expect_doppelganger("mercator projection",
+ pworld + coord_map(projection = "mercator")
+ )
+ vdiffr::expect_doppelganger("ortho projection, default orientation (centered on north pole)",
+ pworld + coord_map(projection = "ortho") +
+ scale_y_continuous(breaks = (-2:2) * 30) +
+ scale_x_continuous(breaks = (-4:4) * 45)
+ )
+ vdiffr::expect_doppelganger("ortho projection, custom orientation (centered on New York)",
+ pworld + coord_map(projection = "ortho", orientation = c(41, -74 ,0)) +
+ scale_y_continuous(breaks = (-2:2) * 30) +
+ scale_x_continuous(breaks = (-4:4) * 45)
+ )
+ # Need to set limits here so left-most longitude line shows up
+ vdiffr::expect_doppelganger("aitoff projection, default orientation",
+ pworld + coord_map(projection = "aitoff") +
+ scale_y_continuous(breaks = (-2:2) * 30) +
+ scale_x_continuous(breaks = (-4:4) * 45, limits = c(-180, 180))
+ )
+ # This drops half of the world, which probably isn't desirable.
+ # It might require rethinking about how limits work.
+ vdiffr::expect_doppelganger("aitoff projection, custom orientation (centered on date line)",
+ pworld + coord_map(projection = "aitoff", orientation = c(90, 180, 0)) +
+ scale_y_continuous(breaks = (-2:2) * 30) +
+ scale_x_continuous(breaks = (0:8) * 45, limits = c(0, 360))
+ )
+ # USA state map
+ states_map <- map_data("state")
+ pstate <- ggplot(states_map, aes(x = long, y = lat, group = group))
+ vdiffr::expect_doppelganger("USA map, mercator projection",
+ pstate + geom_polygon() + coord_map("mercator")
+ )
+})
diff --git a/tests/testthat/test-coord-polar.r b/tests/testthat/test-coord-polar.r
index 53d8eb97d..d2d24d1df 100644
--- a/tests/testthat/test-coord-polar.r
+++ b/tests/testthat/test-coord-polar.r
@@ -57,3 +57,56 @@ test_that("Polar distance calculation ignores NA's", {
dists <- dist_polar(x2, x1)
expect_equal(is.na(dists), c(TRUE, FALSE, TRUE, TRUE))
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("Polar coordinates draws correctly", {
+ dat <- data.frame(x = 0:1, y = rep(1:80, each = 2))
+
+ vdiffr::expect_doppelganger("Concentric circles at theta = 1:80",
+ ggplot(dat, aes(x, y, group = factor(y))) + geom_line() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("Concentric circles at theta = 1:80 - 80",
+ ggplot(dat, aes(x, y - 80, group = factor(y))) + geom_line() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("Concentric circles at theta = 1:80 - 40",
+ ggplot(dat, aes(x, y - 40, group = factor(y))) + geom_line() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("Concentric circles at theta = 1:80 + 100",
+ ggplot(dat, aes(x, y + 100, group = factor(y))) + geom_line() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("Concentric circles at theta = 1:80 mult 100",
+ ggplot(dat, aes(x, y * 100, group = factor(y))) + geom_line() + coord_polar() +
+ ggtitle("Concentric circles at theta = 1:80 * 100")
+ )
+
+ dat <- data.frame(
+ theta = c(0, 2*pi, 2, 6, 6, 1, 1, 0),
+ r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, .5),
+ g = 1:8)
+
+ vdiffr::expect_doppelganger("Rays, circular arcs, and spiral arcs",
+ ggplot(dat, aes(theta, r, colour = g)) + geom_path() +
+ geom_point(alpha = 0.3, colour = "black") + coord_polar()
+ )
+
+ dat <- data.frame(x = LETTERS[1:6], y = 11:16)
+ vdiffr::expect_doppelganger("rose plot with has equal spacing",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar()
+ )
+ vdiffr::expect_doppelganger("continuous theta has merged low/high values",
+ ggplot(dat, aes(as.numeric(x), y)) + geom_point() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("continuous theta with xlim(0, 6) and ylim(0, 16)",
+ ggplot(dat, aes(as.numeric(x), y)) + geom_point() + coord_polar() +
+ xlim(0, 6) + ylim(0,16)
+ )
+ vdiffr::expect_doppelganger("racetrack plot with expand=F: closed and no center hole",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar(theta = "y")
+ )
+ vdiffr::expect_doppelganger("racetrack plot with expand=T: closed and has center hole",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar(theta = "y") +
+ scale_x_discrete(expand = c(0, 0.6))
+ )
+})
diff --git a/tests/testthat/test-geom-boxplot.R b/tests/testthat/test-geom-boxplot.R
index b4a4a5863..feb4aacce 100644
--- a/tests/testthat/test-geom-boxplot.R
+++ b/tests/testthat/test-geom-boxplot.R
@@ -7,3 +7,12 @@ test_that("can use US spelling of colour", {
gpar <- layer_grob(plot)[[1]]$children[[1]]$children[[1]]$gp
expect_equal(gpar$col, "#FF0000FF")
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("boxplot draws correctly", {
+ vdiffr::expect_doppelganger("outlier colours",
+ ggplot(mtcars, aes(x = factor(cyl), y = drat, colour = factor(cyl))) + geom_boxplot(outlier.size = 5)
+ )
+})
diff --git a/tests/testthat/test-geom-dotplot.R b/tests/testthat/test-geom-dotplot.R
new file mode 100644
index 000000000..2827e450a
--- /dev/null
+++ b/tests/testthat/test-geom-dotplot.R
@@ -0,0 +1,137 @@
+context("geom-dotplot")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("geom_dotplot draws correctly", {
+ set.seed(112)
+ dat <- data.frame(x = rnorm(20), g = LETTERS[1:2])
+
+ # Basic dotplot with binning along x axis
+ vdiffr::expect_doppelganger("basic dotplot with dot-density binning, binwidth = .4",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4)
+ )
+ vdiffr::expect_doppelganger("histodot binning (equal bin spacing)",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, method = "histodot")
+ )
+ vdiffr::expect_doppelganger("dots stacked closer: stackratio=.5, fill=white",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackratio = .5, fill = "white")
+ )
+ vdiffr::expect_doppelganger("larger dots: dotsize=1.5, fill=white",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, dotsize = 1.4, fill = "white")
+ )
+
+ # Stacking methods
+ vdiffr::expect_doppelganger("stack up",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up")
+ )
+ vdiffr::expect_doppelganger("stack down",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down")
+ )
+ vdiffr::expect_doppelganger("stack center",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center")
+ )
+ vdiffr::expect_doppelganger("stack centerwhole",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole")
+ )
+
+ # Stacking methods with coord_flip
+ vdiffr::expect_doppelganger("stack up with coord_flip",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up") + coord_flip()
+ )
+ vdiffr::expect_doppelganger("stack down with coord_flip",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down") + coord_flip()
+ )
+ vdiffr::expect_doppelganger("stack center with coord_flip",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center") + coord_flip()
+ )
+ vdiffr::expect_doppelganger("stack centerwhole with coord_flip",
+ ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole") + coord_flip()
+ )
+
+ # Binning along x, with groups
+ vdiffr::expect_doppelganger("multiple groups, bins not aligned",
+ ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = .4, alpha = .4)
+ )
+ vdiffr::expect_doppelganger("multiple groups, bins aligned",
+ ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = .4, alpha = .4, binpositions = "all")
+ )
+
+ # Binning along y axis
+ vdiffr::expect_doppelganger("bin along y, stack center",
+ ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
+ )
+ vdiffr::expect_doppelganger("bin along y, stack centerwhole",
+ ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole")
+ )
+ vdiffr::expect_doppelganger("bin along y, stack centerwhole, histodot",
+ ggplot(dat, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole", method = "histodot")
+ )
+
+ # Binning along y, with multiple grouping factors
+ dat2 <- data.frame(x = LETTERS[1:3], y = rnorm(90), g = LETTERS[1:2])
+
+ vdiffr::expect_doppelganger("bin y, three x groups, stack centerwhole",
+ ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "centerwhole")
+ )
+ vdiffr::expect_doppelganger("bin y, three x groups, bins aligned across groups",
+ ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all")
+ )
+ vdiffr::expect_doppelganger("bin y, three x groups, bins aligned, coord_flip",
+ ggplot(dat2, aes(x, y)) + geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all") +
+ coord_flip()
+ )
+ vdiffr::expect_doppelganger("bin y, dodged",
+ ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
+ geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center")
+ )
+ vdiffr::expect_doppelganger("bin y, dodged, coord_flip",
+ ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
+ geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center") +
+ coord_flip()
+ )
+ vdiffr::expect_doppelganger("bin y, three x groups, fill and dodge",
+ ggplot(dat2, aes(x, y, fill = g)) + scale_y_continuous(breaks = seq(-4 ,4, .4)) +
+ geom_dotplot(binwidth = .2, position = "dodge", binaxis = "y", stackdir = "center")
+ )
+ vdiffr::expect_doppelganger("bin y, continous x-axis, grouping by x",
+ ggplot(dat2, aes(as.numeric(x), y, group = x)) + geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
+ )
+ vdiffr::expect_doppelganger("bin y, continous x-axis, single x group",
+ ggplot(dat2, aes(as.numeric(x), y)) + geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
+ )
+
+ # Stacking groups
+ vdiffr::expect_doppelganger("stackgroups with 3 groups, dot-density with aligned bins",
+ ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, binpositions = "all", alpha = 0.5)
+ )
+ vdiffr::expect_doppelganger("stackgroups with 3 groups, histodot",
+ ggplot(dat2, aes(y, fill = x)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
+ )
+ vdiffr::expect_doppelganger("stackgroups with 3 groups, bin y, histodot",
+ ggplot(dat2, aes(1, y, fill = x)) + geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
+ )
+
+ # This one is currently broken but it would be a really rare case, and it
+ # probably requires a really ugly hack to fix
+ vdiffr::expect_doppelganger("bin y, dodging, 3 stackgroups, histodot (currently broken)",
+ ggplot(dat2, aes(x, y, fill = g)) +
+ geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot",
+ alpha = 0.5, stackdir = "centerwhole")
+ )
+ vdiffr::expect_doppelganger("facets, 3 groups, histodot, stackgroups",
+ ggplot(dat2, aes(y, fill = g)) + geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5) +
+ facet_grid(x ~ .)
+ )
+
+ # Missing values
+ dat2 <- dat
+ dat2$x[c(1, 10)] <- NA
+
+ expect_warning(vdiffr::expect_doppelganger("2 NA values, dot-density binning, binwidth = .4",
+ ggplot(dat2, aes(x)) + geom_dotplot(binwidth = .4)
+ ))
+ expect_warning(vdiffr::expect_doppelganger("2 NA values, bin along y, stack center",
+ ggplot(dat2, aes(0, x)) + geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
+ ))
+})
diff --git a/tests/testthat/test-geom-hline-vline-abline.R b/tests/testthat/test-geom-hline-vline-abline.R
new file mode 100644
index 000000000..eec4f2016
--- /dev/null
+++ b/tests/testthat/test-geom-hline-vline-abline.R
@@ -0,0 +1,98 @@
+context("geom-hline-vline-abline")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("straight lines are drawn correctly", {
+ dat <- data.frame(x = LETTERS[1:5], y = 1:5)
+
+ # geom_abline tests
+ vdiffr::expect_doppelganger("geom_abline: int=2, slope=0",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_abline(intercept = 2, slope = 0, colour = "red")
+ )
+ vdiffr::expect_doppelganger("geom_abline: int=0, slope=1, aligns with bars",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_abline(intercept = 0, slope = 1, colour = "red")
+ )
+ vdiffr::expect_doppelganger("geom_abline, coord_flip: int=2, slope=0",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_abline(intercept = 2, slope = 0, colour = "red") +
+ coord_flip()
+ )
+ vdiffr::expect_doppelganger("geom_abline, coord_flip: int=0, slope=1, aligns with bars",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_abline(intercept = 0, slope = 1, colour = "red") +
+ coord_flip()
+ )
+
+ # geom_hline tests
+ vdiffr::expect_doppelganger("geom_hline: intercept=2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_hline(yintercept = 2, colour = "red")
+ )
+ vdiffr::expect_doppelganger("geom_hline, coord_flip: intercept=2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_hline(yintercept = 2, colour = "red") +
+ coord_flip()
+ )
+ vdiffr::expect_doppelganger("geom_hline, coord_polar: int=2, expect circle at r=2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_hline(yintercept = 2, colour = "red") +
+ coord_polar()
+ )
+
+ # geom_vline tests
+ vdiffr::expect_doppelganger("geom_vline: intercept=2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_vline(xintercept = 2, colour = "red")
+ )
+ vdiffr::expect_doppelganger("geom_vline, coord_flip: intercept=2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_vline(xintercept = 2, colour = "red") +
+ coord_flip()
+ )
+ vdiffr::expect_doppelganger("geom_vline, coord_polar: int=2, expect a ray at 2",
+ ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
+ geom_vline(xintercept = 2, colour = "red") +
+ coord_polar()
+ )
+
+ # hline, vline, and abline tests with coord_map
+ library(maps)
+ library(mapproj)
+
+ nz <- data.frame(map("nz", plot = FALSE)[c("x", "y")])
+ nzmap <- qplot(x, y, data = nz, geom = "path")
+
+ vdiffr::expect_doppelganger("geom_hline: int=-45, proj=mercator",
+ nzmap + geom_hline(yintercept = -45) + coord_map()
+ )
+ vdiffr::expect_doppelganger("geom_vline: int=172, proj=mercator",
+ nzmap + geom_vline(xintercept = 172) + coord_map()
+ )
+ vdiffr::expect_doppelganger("geom_abline: int=130, slope=-1 proj=mercator",
+ nzmap + geom_abline(intercept = 130, slope = -1) + coord_map()
+ )
+ vdiffr::expect_doppelganger("geom_hline: int=-45, proj=cylindrical",
+ nzmap + geom_hline(yintercept = -45) + coord_map(projection = "cylindrical")
+ )
+ vdiffr::expect_doppelganger("geom_vline: int=172, proj=cylindrical",
+ nzmap + geom_vline(xintercept = 172) + coord_map(projection = "cylindrical")
+ )
+ vdiffr::expect_doppelganger("geom_abline: int=130, slope=-1, proj=cylindrical",
+ nzmap + geom_abline(intercept = 130, slope = -1) + coord_map(projection = "cylindrical")
+ )
+ vdiffr::expect_doppelganger("geom_hline: int=-45, proj=azequalarea",
+ nzmap + geom_hline(yintercept = -45) +
+ coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
+ )
+ vdiffr::expect_doppelganger("geom_vline: int=172, proj=azequalara",
+ nzmap + geom_vline(xintercept = 172) +
+ coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
+ )
+ vdiffr::expect_doppelganger("geom_abline: int=130, slope=-1, proj=azequalarea",
+ nzmap + geom_abline(intercept = 130, slope = -1) +
+ coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
+ )
+})
diff --git a/tests/testthat/test-geom-path.R b/tests/testthat/test-geom-path.R
new file mode 100644
index 000000000..00a389116
--- /dev/null
+++ b/tests/testthat/test-geom-path.R
@@ -0,0 +1,29 @@
+context("geom-path")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("geom_path draws correctly", {
+ set.seed(1)
+
+ nCategory <- 5
+ nItem <- 6
+ df <- data.frame(category = rep(LETTERS[1:nCategory], 1, each = nItem),
+ item = paste("Item#", rep(1:nItem, nCategory, each = 1), sep = ''),
+ value = rep(1:nItem, nCategory, each = 1) + runif(nCategory * nItem) * 0.8)
+
+ df2 <- df[c(1, 2, 7, 8, 13, 14, 3:6, 9:12, 15:nrow(df)), ]
+
+ vdiffr::expect_doppelganger("lines",
+ ggplot(df) + geom_path(aes(x = value, y = category, group = item))
+ )
+ vdiffr::expect_doppelganger("lines with changed data order, should have same appearance",
+ ggplot(df2) + geom_path(aes(x = value, y = category, group = item))
+ )
+ vdiffr::expect_doppelganger("lines, colour",
+ ggplot(df) + geom_path(aes(x = value, y = category, group = item, colour = item))
+ )
+ vdiffr::expect_doppelganger("lines, colour, with changed data order, should have same appearance",
+ ggplot(df2) + geom_path(aes(x = value, y = category, group = item, colour = item))
+ )
+})
diff --git a/tests/testthat/test-geom-polygon.R b/tests/testthat/test-geom-polygon.R
new file mode 100644
index 000000000..3f674c05e
--- /dev/null
+++ b/tests/testthat/test-geom-polygon.R
@@ -0,0 +1,17 @@
+context("geom-polygon")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("geom_polygon draws correctly", {
+ vdiffr::expect_doppelganger("stat_density2d with paths",
+ ggplot(faithful, aes(x = eruptions, y = waiting)) +
+ stat_density_2d(aes(colour = ..level..), geom = "path") +
+ xlim(0.5, 6) + ylim(40, 110)
+ )
+ vdiffr::expect_doppelganger("stat_density2d with filled polygons",
+ ggplot(faithful, aes(x = eruptions, y = waiting)) +
+ stat_density2d(aes(fill = ..level..), geom = "polygon", colour = "white") +
+ xlim(0.5, 6) + ylim(40, 110)
+ )
+})
diff --git a/tests/testthat/test-geom-raster.R b/tests/testthat/test-geom-raster.R
new file mode 100644
index 000000000..235152b36
--- /dev/null
+++ b/tests/testthat/test-geom-raster.R
@@ -0,0 +1,63 @@
+context("geom-raster")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("geom_raster draws correctly", {
+ set.seed(1)
+
+ # 3 x 2 ----------------------------------------------------------------------
+ df <- data.frame(x = rep(c(-1, 1), each = 3), y = rep(-1:1, 2), z = 1:6)
+
+ vdiffr::expect_doppelganger("3 x 2",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
+ )
+ vdiffr::expect_doppelganger("3 x 2, set limits",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
+ xlim(-2, 2) + ylim(-2, 2)
+ )
+ vdiffr::expect_doppelganger("3 x 2, just = (0, 0)",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
+ geom_point(colour = "red")
+ )
+
+ # 1 x 3 ----------------------------------------------------------------------
+ df <- data.frame(x = -1:1, y = 0, z = 1:3)
+
+ vdiffr::expect_doppelganger("1 x 3",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
+ )
+ vdiffr::expect_doppelganger("1 x 3, set limits",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
+ xlim(-2, 2) + ylim(-2, 2)
+ )
+ vdiffr::expect_doppelganger("1 x 3, just = (0, 0)",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
+ geom_point(colour = "red")
+ )
+
+ # 3 x 1 ----------------------------------------------------------------------
+
+ df <- data.frame(x = 0, y = -1:1, z = 1:3)
+ vdiffr::expect_doppelganger("3 x 1",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
+ )
+ vdiffr::expect_doppelganger("3 x 1, set limits",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
+ xlim(-2, 2) + ylim(-2, 2)
+ )
+ vdiffr::expect_doppelganger("3 x 1, just = (0, 0)",
+ ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
+ geom_point(colour = "red")
+ )
+
+ # Categorical fill, irregular swatches ---------------------------------------
+
+ df <- expand.grid(x = 1:10, y = 1:10)
+ df$col <- (df$x + df$y) %% 2
+ df$col[df$x == 5 & df$col == 1] <- NA
+ df$col[df$y == 5 & df$col == 0] <- NA
+ vdiffr::expect_doppelganger("irregular categorical",
+ qplot(x, y, data = df, fill = factor(col), geom = "raster")
+ )
+})
diff --git a/tests/testthat/test-geom-violin.R b/tests/testthat/test-geom-violin.R
index 84fef52ea..0c81e8b99 100644
--- a/tests/testthat/test-geom-violin.R
+++ b/tests/testthat/test-geom-violin.R
@@ -34,3 +34,57 @@ test_that("quantiles do not fail on zero-range data", {
expect_equal(length(layer_grob(p)), 1)
})
+
+# Visual tests ------------------------------------------------------------
+
+test_that("geom_violin draws correctly", {
+ set.seed(111)
+ dat <- data.frame(x = LETTERS[1:3], y = rnorm(90))
+ dat <- dat[dat$x != "C" | c(T, F),] # Keep half the C's
+
+ vdiffr::expect_doppelganger("basic",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin()
+ )
+ vdiffr::expect_doppelganger("scale area to sample size (C is smaller)",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin(scale = "count"),
+ )
+ vdiffr::expect_doppelganger("narrower (width=.5)",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin(width = .5)
+ )
+ vdiffr::expect_doppelganger("with tails and points",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin(trim = FALSE) + geom_point(shape = 21)
+ )
+ vdiffr::expect_doppelganger("with smaller bandwidth and points",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin(adjust = .3) + geom_point(shape = 21)
+ )
+ vdiffr::expect_doppelganger("dodging",
+ ggplot(dat, aes(x = "foo", y = y, fill = x)) + geom_violin()
+ )
+ vdiffr::expect_doppelganger("coord_polar",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin() + coord_polar()
+ )
+ vdiffr::expect_doppelganger("coord_flip",
+ ggplot(dat, aes(x = x, y = y)) + geom_violin() + coord_flip()
+ )
+ vdiffr::expect_doppelganger("dodging and coord_flip",
+ ggplot(dat, aes(x = "foo", y = y, fill = x)) + geom_violin() + coord_flip()
+ )
+ vdiffr::expect_doppelganger("continuous x axis, multiple groups (center should be at 2.0)",
+ ggplot(dat, aes(x = as.numeric(x), y = y)) + geom_violin()
+ )
+ vdiffr::expect_doppelganger("continuous x axis, single group (center should be at 1.0)",
+ ggplot(dat, aes(x = as.numeric(1), y = y)) + geom_violin()
+ )
+ vdiffr::expect_doppelganger("quantiles",
+ ggplot(dat, aes(x=x, y=y)) + geom_violin(draw_quantiles=c(0.25,0.5,0.75))
+ )
+
+ dat2 <- data.frame(x = LETTERS[1:3], y = rnorm(90), g = letters[5:6])
+ vdiffr::expect_doppelganger("grouping on x and fill",
+ ggplot(dat2, aes(x = x, y = y, fill = g)) + geom_violin()
+ )
+ vdiffr::expect_doppelganger("grouping on x and fill, dodge width = 0.5",
+ ggplot(dat2, aes(x = x, y = y, fill = g)) +
+ geom_violin(position = position_dodge(width = .5))
+ )
+})
diff --git a/tests/testthat/test-guides.R b/tests/testthat/test-guides.R
index ba248999b..fedacaa08 100644
--- a/tests/testthat/test-guides.R
+++ b/tests/testthat/test-guides.R
@@ -17,3 +17,92 @@ test_that("Colorbar respects show.legend in layer", {
geom_point(size = 20, shape = 21, show.legend = TRUE)
expect_true("guide-box" %in% ggplotGrob(p)$layout$name)
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("axis guides are drawn correctly", {
+ vdiffr::expect_doppelganger("align facet labels, facets horizontal",
+ qplot(hwy, reorder(model, hwy), data = mpg) +
+ facet_grid(manufacturer ~ ., scales = "free", space = "free") +
+ theme(strip.text.y = element_text(angle = 0))
+ )
+ vdiffr::expect_doppelganger("align facet labels, facets vertical",
+ qplot(reorder(model, hwy), hwy, data = mpg) +
+ facet_grid(. ~ manufacturer, scales = "free", space = "free") +
+ theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
+ )
+ vdiffr::expect_doppelganger("thick axis lines",
+ qplot(wt, mpg, data = mtcars) +
+ theme(axis.line = element_line(size = 5, lineend = "square"))
+ )
+})
+
+test_that("guides are positioned correctly", {
+ p1 <- ggplot(mtcars, aes(mpg, disp, colour = cyl)) +
+ geom_point() +
+ labs(title = "title of plot") +
+ theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) +
+ scale_x_continuous(breaks = mean(mtcars$mpg), labels = "very very long long axis label") +
+ scale_y_continuous(breaks = mean(mtcars$disp), labels = "very very long long axis label")
+
+ vdiffr::expect_doppelganger("legend on left",
+ p1 + theme(legend.position = "left")
+ )
+ vdiffr::expect_doppelganger("legend on bottom",
+ p1 + theme(legend.position = "bottom")
+ )
+ vdiffr::expect_doppelganger("legend on right",
+ p1 + theme(legend.position = "right")
+ )
+ vdiffr::expect_doppelganger("legend on top",
+ p1 + theme(legend.position = "top")
+ )
+ vdiffr::expect_doppelganger("facet_grid, legend on left",
+ p1 + facet_grid(am~vs) + theme(legend.position = "left")
+ )
+ vdiffr::expect_doppelganger("facet_grid, legend on bottom",
+ p1 + facet_grid(am~vs) + theme(legend.position = "bottom")
+ )
+ vdiffr::expect_doppelganger("facet_grid, legend on right",
+ p1 + facet_grid(am~vs) + theme(legend.position = "right")
+ )
+ vdiffr::expect_doppelganger("facet_grid, legend on top",
+ p1 + facet_grid(am~vs) + theme(legend.position = "top")
+ )
+ vdiffr::expect_doppelganger("facet_wrap, legend on left",
+ p1 + facet_wrap(am~vs) + theme(legend.position = "left")
+ )
+ vdiffr::expect_doppelganger("facet_wrap, legend on bottom",
+ p1 + facet_wrap(am~vs) + theme(legend.position = "bottom")
+ )
+ vdiffr::expect_doppelganger("facet_wrap, legend on right",
+ p1 + facet_wrap(am~vs) + theme(legend.position = "right")
+ )
+ vdiffr::expect_doppelganger("facet_wrap, legend on top",
+ p1 + facet_wrap(am~vs) + theme(legend.position = "top")
+ )
+
+ # padding
+ dat <- data.frame(x = LETTERS[1:3], y = 1)
+ p2 <- ggplot(dat, aes(x, y, fill = x, colour = 1:3)) +
+ geom_bar(stat = "identity") +
+ guides(color = "colorbar") +
+ theme(legend.background = element_rect(colour = "black"))
+
+ vdiffr::expect_doppelganger("padding in legend box", p2)
+
+ # Placement of legend inside
+ vdiffr::expect_doppelganger("legend inside plot, centered",
+ p2 + theme(legend.position = c(.5, .5))
+ )
+ vdiffr::expect_doppelganger("legend inside plot, bottom left",
+ p2 + theme(legend.justification = c(0,0), legend.position = c(0,0))
+ )
+ vdiffr::expect_doppelganger("legend inside plot, top right",
+ p2 + theme(legend.justification = c(1,1), legend.position = c(1,1))
+ )
+ vdiffr::expect_doppelganger("legend inside plot, bottom left of legend at center",
+ p2 + theme(legend.justification = c(0,0), legend.position = c(.5,.5))
+ )
+})
diff --git a/tests/testthat/test-scale_date.R b/tests/testthat/test-scale_date.R
new file mode 100644
index 000000000..cb91a6d8f
--- /dev/null
+++ b/tests/testthat/test-scale_date.R
@@ -0,0 +1,39 @@
+context("scale_date")
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("date scale draws correctly", {
+ set.seed(321)
+ df <- data.frame(
+ dx = seq(as.Date("2012-02-29"), length.out = 100, by = "1 day")[sample(100, 50)],
+ price = runif(50)
+ )
+ df <- df[order(df$dx), ]
+
+ dt <- qplot(dx, price, data = df, geom = "line")
+ vdiffr::expect_doppelganger("dates along x, default breaks",
+ dt
+ )
+ vdiffr::expect_doppelganger("scale_x_date(breaks = date_breaks(\"2 weeks\"))",
+ dt + scale_x_date(breaks = date_breaks("2 weeks"))
+ )
+ vdiffr::expect_doppelganger("scale_x_date(breaks = \"3 weeks\")",
+ dt + scale_x_date(date_breaks = "3 weeks")
+ )
+ vdiffr::expect_doppelganger("scale_x_date(labels = date_format(\"%m/%d\"))",
+ dt + scale_x_date(labels = date_format("%m/%d"))
+ )
+ vdiffr::expect_doppelganger("scale_x_date(labels = date_format(\"%W\"), \"week\")",
+ dt + scale_x_date(labels = date_format("%W"), "week")
+ )
+
+ dt <- qplot(price, dx, data = df, geom = "line")
+ vdiffr::expect_doppelganger("dates along y, default breaks", dt)
+ vdiffr::expect_doppelganger("scale_y_date(breaks = date_breaks(\"2 weeks\"))",
+ dt + scale_y_date(breaks = date_breaks("2 weeks"))
+ )
+ vdiffr::expect_doppelganger("scale_y_date(breaks = \"3 weeks\")",
+ dt + scale_y_date(date_breaks = "3 weeks")
+ )
+})
diff --git a/tests/testthat/test-scales-breaks-labels.r b/tests/testthat/test-scales-breaks-labels.r
index 5e0c21ea4..911053b2c 100644
--- a/tests/testthat/test-scales-breaks-labels.r
+++ b/tests/testthat/test-scales-breaks-labels.r
@@ -255,3 +255,67 @@ test_that("minor breaks are transformed by scales", {
expect_equal(sc$get_breaks_minor(), c(0, 1, 2))
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("minor breaks draws correctly", {
+ p <- ggplot(NULL, aes(1:3, 1:3)) + geom_point() +
+ scale_x_continuous(breaks = 1:3, minor_breaks = c(1.25, 2.75)) +
+ scale_y_continuous(breaks = 1:3, minor_breaks = c(1.25, 2.75))
+
+ vdiffr::expect_doppelganger("manual minor breaks", p)
+ vdiffr::expect_doppelganger("manual minor breaks with coord_polar",
+ p + coord_polar()
+ )
+
+ set.seed(342)
+ df <- data.frame(
+ date = seq(as.Date("2012-2-29"), length.out = 100, by = "1 day")[sample(100, 50)],
+ price = runif(50)
+ )
+ df <- df[order(df$date), ]
+ library(scales)
+ p <- qplot(date, price, data = df, geom = "line") +
+ scale_x_date(
+ labels = date_format("%m/%d"),
+ breaks = date_breaks("month"),
+ minor_breaks = date_breaks("week")
+ )
+
+ vdiffr::expect_doppelganger("months and weeks breaks", p)
+ vdiffr::expect_doppelganger("months and weeks breaks: coord polar", p + coord_polar())
+ vdiffr::expect_doppelganger("default breaks",
+ ggplot(NULL, aes(letters[1:3], 1:3)) + geom_point()
+ )
+ vdiffr::expect_doppelganger("scale_x_continuous(trans = log2_trans()) + scale_y_log10",
+ qplot(1:1e4, 1:1e4) + scale_x_continuous(trans = log2_trans()) + scale_y_log10()
+ )
+ vdiffr::expect_doppelganger("x and y transformations",
+ qplot(1:5, 1:5) + scale_x_continuous(trans = exp_trans(2)) + scale_y_continuous(trans = exp_trans(2)) +
+ ggtitle("scale_x_continuous(trans = exp_trans(2)) + scale_y_continuous(trans = exp_trans(2))")
+ )
+})
+
+test_that("scale breaks can be removed", {
+ dat <- data.frame(x = 1:3, y = 1:3)
+
+ vdiffr::expect_doppelganger("no x breaks",
+ ggplot(dat, aes(x = x, y = y)) + geom_point() + scale_x_continuous(breaks = NULL)
+ )
+ vdiffr::expect_doppelganger("no y breaks",
+ ggplot(dat, aes(x = x, y = y)) + geom_point() + scale_y_continuous(breaks = NULL)
+ )
+ vdiffr::expect_doppelganger("no alpha breaks (no legend)",
+ ggplot(dat, aes(x = 1, y = y, alpha = x)) + geom_point() + scale_alpha_continuous(breaks = NULL)
+ )
+ vdiffr::expect_doppelganger("no size breaks (no legend)",
+ ggplot(dat, aes(x = 1, y = y, size = x)) + geom_point() + scale_size_continuous(breaks = NULL)
+ )
+ vdiffr::expect_doppelganger("no fill breaks (no legend)",
+ ggplot(dat, aes(x = 1, y = y, fill = x)) + geom_point(shape = 21) + scale_fill_continuous(breaks = NULL)
+ )
+ vdiffr::expect_doppelganger("no colour breaks (no legend)",
+ ggplot(dat, aes(x = 1, y = y, colour = x)) + geom_point() + scale_colour_continuous(breaks = NULL)
+ )
+})
diff --git a/tests/testthat/test-stat-sum.R b/tests/testthat/test-stat-sum.R
index 4150a1027..8b898b707 100644
--- a/tests/testthat/test-stat-sum.R
+++ b/tests/testthat/test-stat-sum.R
@@ -41,3 +41,34 @@ test_that("handles grouping correctly", {
expect_equal(sum(ret$n), sum(d$price))
expect_equal(sum(ret$prop), 1)
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("summaries are drawn correctly", {
+ vdiffr::expect_doppelganger("summary with color and lines",
+ ggplot(mtcars, aes(x = cyl, y = mpg, colour = factor(vs))) +
+ geom_point() +
+ stat_summary(fun.y = mean, geom = "line", size = 2)
+ )
+ vdiffr::expect_doppelganger("summary with crossbars, no grouping",
+ ggplot(mtcars, aes(x = cyl, y = mpg)) +
+ geom_point() +
+ stat_summary(
+ fun.data = mean_cl_boot,
+ colour = "red",
+ geom = "crossbar",
+ width = 0.2
+ )
+ )
+ vdiffr::expect_doppelganger("summary with crossbars, manual grouping",
+ ggplot(mtcars, aes(x = cyl, y = mpg, group = cyl)) +
+ geom_point() +
+ stat_summary(
+ fun.data = mean_cl_boot,
+ colour = "red",
+ geom = "crossbar",
+ width = 0.2
+ )
+ )
+})
diff --git a/tests/testthat/test-theme.r b/tests/testthat/test-theme.r
index 12e56f200..76401e921 100644
--- a/tests/testthat/test-theme.r
+++ b/tests/testthat/test-theme.r
@@ -201,3 +201,107 @@ test_that("All elements in complete themes have inherit.blank=TRUE", {
expect_true(inherit_blanks(theme_minimal()))
expect_true(inherit_blanks(theme_void()))
})
+
+
+# Visual tests ------------------------------------------------------------
+
+test_that("aspect ratio is honored", {
+ p <- ggplot(data.frame(x = 1:8, y = 1:8, f = gl(2,4), expand.grid(f1 = 1:2, f2 = 1:2, rep = 1:2)), aes(x, y)) + geom_point()
+
+ vdiffr::expect_doppelganger("height is 3 times width",
+ p + theme(aspect.ratio = 3))
+ vdiffr::expect_doppelganger("height is 3 times width, 2 wrap facets",
+ p + facet_wrap(~f) + theme(aspect.ratio = 3)
+ )
+ vdiffr::expect_doppelganger("height is 3 times width, 2 column facets",
+ p + facet_grid(.~f) + theme(aspect.ratio = 3)
+ )
+ vdiffr::expect_doppelganger("height is 3 times width, 2 row facets",
+ p + facet_grid(f~.) + theme(aspect.ratio = 3)
+ )
+ vdiffr::expect_doppelganger("height is 3 times width, 2x2 facets",
+ p + facet_grid(f1~f2) + theme(aspect.ratio = 3)
+ )
+
+ vdiffr::expect_doppelganger("width is 3 times height",
+ p + theme(aspect.ratio = 1/3)
+ )
+ vdiffr::expect_doppelganger("width is 3 times height, 2 wrap facets",
+ p + facet_wrap(~f) + theme(aspect.ratio = 1/3)
+ )
+ vdiffr::expect_doppelganger("width is 3 times height, 2 column facets",
+ p + facet_grid(.~f) + theme(aspect.ratio = 1/3)
+ )
+ vdiffr::expect_doppelganger("width is 3 times height, 2 row facets",
+ p + facet_grid(f~.) + theme(aspect.ratio = 1/3)
+ )
+ vdiffr::expect_doppelganger("width is 3 times height, 2x2 facets",
+ p + facet_grid(f1~f2) + theme(aspect.ratio = 1/3)
+ )
+})
+
+test_that("themes are drawn in the right style", {
+ library(grid)
+ p <- qplot(1:3, 1:3)
+
+ # Tests for adding theme objects together
+ # Some of these add directly to ggplot object; others add to theme object first
+ vdiffr::expect_doppelganger("theme_bw() plus blue text",
+ p + theme_bw() + theme(text = element_text(colour = 'blue')),
+ )
+
+ t <- theme_bw() + theme(text = element_text(colour = 'blue'))
+ vdiffr::expect_doppelganger("add saved theme object with theme_bw() plus blue text",
+ p + t
+ )
+ vdiffr::expect_doppelganger("blue text plus theme_bw() - result is black text",
+ p + theme(text = element_text(colour = 'blue')) + theme_bw()
+ )
+
+ t <- theme(text = element_text(colour = 'blue')) + theme_bw()
+ vdiffr::expect_doppelganger("add blue saved theme object and theme_bw() - expect black text",
+ p + t
+ )
+ vdiffr::expect_doppelganger("add blue and italic in single element object",
+ p + theme(text = element_text(colour = 'blue', face = 'italic'))
+ )
+ vdiffr::expect_doppelganger("add blue and italic in separate element objects",
+ p +
+ theme(text = element_text(colour = 'blue')) +
+ theme(text = element_text(face = 'italic'))
+ )
+
+ # Inheritance tests
+ vdiffr::expect_doppelganger('add theme_bw(base_size=24, base_family="serif")',
+ p + theme_bw(base_size = 24, base_family = "serif") + labs(title = "Title text here")
+ )
+ vdiffr::expect_doppelganger("axis title text is blue, compounded relative sizing",
+ p + theme_bw() +
+ theme(axis.title = element_text(size = rel(2), colour = 'blue')) +
+ theme(axis.title.x = element_text(size = rel(2)))
+ )
+
+ # Next two tests contrast the + operator with the %+replace% operator
+ vdiffr::expect_doppelganger("theme_bw + larger relative size for axis.title.y",
+ p + theme_bw() + theme(axis.title.y = element_text(size = rel(2)))
+ )
+
+ vdiffr::expect_doppelganger("theme_bw %+replace% larger relative size for axis.title.y",
+ p + theme_bw() %+replace% theme(axis.title.y = element_text(size = rel(2))) +
+ ggtitle("theme_bw %+replace% larger relative size for axis.title.y, expect angle=0")
+ )
+
+ vdiffr::expect_doppelganger("text is element_blank - result is no text",
+ p + theme_bw() + theme(text = element_blank())
+ )
+
+ # Testing specific elements
+ vdiffr::expect_doppelganger("many blank items, and light blue plot background",
+ p + theme(
+ axis.text = element_blank(), axis.ticks = element_blank(),
+ axis.title = element_blank(),
+ plot.background = element_rect(fill = "lightblue"),
+ panel.border = element_rect(colour = "black", size = 4, fill = NA)
+ )
+ )
+})
diff --git a/visual_test/.gitignore b/visual_test/.gitignore
deleted file mode 100644
index 26b647c67..000000000
--- a/visual_test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-vtest
diff --git a/visual_test/aesthetics.r b/visual_test/aesthetics.r
deleted file mode 100644
index c0e30c528..000000000
--- a/visual_test/aesthetics.r
+++ /dev/null
@@ -1,26 +0,0 @@
-vcontext("Aesthetics")
-
-dat <- data.frame(xvar = letters[1:3], yvar = 7:9)
-
-ggplot(dat, aes(x = xvar, y = yvar)) + geom_bar(stat = "identity")
-save_vtest("stat='identity'")
-
-ggplot(dat, aes(x = xvar, y = yvar)) + geom_bar(stat = "identity", width = 0.5)
-save_vtest("stat='identity', width=0.5")
-
-ggplot(dat, aes(x = xvar, y = yvar)) + geom_bar(stat = "identity", aes(width = 0.5))
-save_vtest("stat='identity', aes(width=0.5)")
-
-
-ggplot(dat, aes(x = xvar)) + geom_bar(stat = "count")
-save_vtest("stat='count'")
-
-ggplot(dat, aes(x = xvar)) + geom_bar(stat = "count", width = 0.5)
-save_vtest("stat='count', width=0.5")
-
-ggplot(dat, aes(x = xvar)) + geom_bar(stat = "count", aes(width = 0.5))
-save_vtest("stat='count', aes(width=0.5)")
-
-#TODO: Clean these up a bit
-
-end_vcontext()
diff --git a/visual_test/alpha.r b/visual_test/alpha.r
deleted file mode 100644
index c486dddbd..000000000
--- a/visual_test/alpha.r
+++ /dev/null
@@ -1,9 +0,0 @@
-vcontext("Alpha")
-
-qplot(1, 1, color = I("#cc000044"), size = I(50))
-save_vtest("Alpha set in colour")
-
-qplot(1, 1, color = I("#cc0000"), size = I(50), alpha = I(0.27))
-save_vtest("Alpha set in alpha")
-
-end_vcontext()
\ No newline at end of file
diff --git a/visual_test/aspect-ratio.r b/visual_test/aspect-ratio.r
deleted file mode 100644
index 8f34b720b..000000000
--- a/visual_test/aspect-ratio.r
+++ /dev/null
@@ -1,28 +0,0 @@
-vcontext("aspect-ratio")
-
-p <- ggplot(data.frame(x = 1:8, y = 1:8, f = gl(2,4), expand.grid(f1 = 1:2, f2 = 1:2, rep = 1:2)), aes(x, y)) + geom_point()
-
-p + theme(aspect.ratio = 3)
-save_vtest("height is 3 times width")
-p + facet_wrap(~f) + theme(aspect.ratio = 3)
-save_vtest("height is 3 times width, 2 wrap facets")
-p + facet_grid(.~f) + theme(aspect.ratio = 3)
-save_vtest("height is 3 times width, 2 column facets")
-p + facet_grid(f~.) + theme(aspect.ratio = 3)
-save_vtest("height is 3 times width, 2 row facets")
-p + facet_grid(f1~f2) + theme(aspect.ratio = 3)
-save_vtest("height is 3 times width, 2x2 facets")
-
-
-p + theme(aspect.ratio = 1/3)
-save_vtest("width is 3 times height")
-p + facet_wrap(~f) + theme(aspect.ratio = 1/3)
-save_vtest("width is 3 times height, 2 wrap facets")
-p + facet_grid(.~f) + theme(aspect.ratio = 1/3)
-save_vtest("width is 3 times height, 2 column facets")
-p + facet_grid(f~.) + theme(aspect.ratio = 1/3)
-save_vtest("width is 3 times height, 2 row facets")
-p + facet_grid(f1~f2) + theme(aspect.ratio = 1/3)
-save_vtest("width is 3 times height, 2x2 facets")
-
-end_vcontext()
diff --git a/visual_test/boxplot.r b/visual_test/boxplot.r
deleted file mode 100644
index 156a554c3..000000000
--- a/visual_test/boxplot.r
+++ /dev/null
@@ -1,7 +0,0 @@
-vcontext("boxplot")
-
-ggplot(mtcars, aes(x = factor(cyl), y = drat, colour = factor(cyl))) +
- geom_boxplot(outlier.size = 5)
-save_vtest("outlier colours")
-
-end_vcontext()
diff --git a/visual_test/coord-cartesian-with-limits.r b/visual_test/coord-cartesian-with-limits.r
deleted file mode 100644
index c17eb95ec..000000000
--- a/visual_test/coord-cartesian-with-limits.r
+++ /dev/null
@@ -1,12 +0,0 @@
-vcontext("coord-cartesian-with-limits")
-## test codes of coord_cartesion with range specification.
-
-p <- ggplot(mtcars, aes(wt, mpg)) + geom_point()
-
-p + coord_cartesian(xlim = c(0, 10), ylim = c(0, 50))
-save_vtest("expand range")
-
-p + coord_cartesian(xlim = c(2, 4), ylim = c(20, 40))
-save_vtest("contract range")
-
-end_vcontext()
diff --git a/visual_test/coord-map.r b/visual_test/coord-map.r
deleted file mode 100644
index 8ed2336a0..000000000
--- a/visual_test/coord-map.r
+++ /dev/null
@@ -1,52 +0,0 @@
-vcontext("coord-map")
-
-library(maps)
-
-# World map
-world_map <- map_data("world")
-pworld <- ggplot(world_map, aes(x = long, y = lat, group = group)) +
- geom_polygon()
-
-
-pworld
-save_vtest("no projection")
-
-
-pworld + coord_map(projection = "mercator")
-save_vtest("mercator projection")
-
-
-pworld + coord_map(projection = "ortho") +
- scale_y_continuous(breaks = (-2:2) * 30) +
- scale_x_continuous(breaks = (-4:4) * 45)
-save_vtest("ortho projection, default orientation (centered on north pole)")
-
-pworld + coord_map(projection = "ortho", orientation = c(41, -74 ,0)) +
- scale_y_continuous(breaks = (-2:2) * 30) +
- scale_x_continuous(breaks = (-4:4) * 45)
-save_vtest("ortho projection, custom orientation (centered on New York)")
-
-
-# Need to set limits here so left-most longitude line shows up
-pworld + coord_map(projection = "aitoff") +
- scale_y_continuous(breaks = (-2:2) * 30) +
- scale_x_continuous(breaks = (-4:4) * 45, limits = c(-180, 180))
-save_vtest("aitoff projection, default orientation")
-
-
-# This drops half of the world, which probably isn't desirable.
-# It might require rethinking about how limits work.
-pworld + coord_map(projection = "aitoff", orientation = c(90, 180, 0)) +
- scale_y_continuous(breaks = (-2:2) * 30) +
- scale_x_continuous(breaks = (0:8) * 45, limits = c(0, 360))
-save_vtest("aitoff projection, custom orientation (centered on date line)")
-
-
-# USA state map
-states_map <- map_data("state")
-pstate <- ggplot(states_map, aes(x = long, y = lat, group = group))
-
-pstate + geom_polygon() + coord_map("mercator")
-save_vtest("USA map, mercator projection")
-
-end_vcontext()
diff --git a/visual_test/coord-polar.r b/visual_test/coord-polar.r
deleted file mode 100644
index a67828ea9..000000000
--- a/visual_test/coord-polar.r
+++ /dev/null
@@ -1,48 +0,0 @@
-vcontext("coord-polar")
-
-dat <- data.frame(x = 0:1, y = rep(1:80, each = 2))
-
-ggplot(dat, aes(x, y, group = factor(y))) + geom_line() + coord_polar()
-save_vtest("Concentric circles at theta = 1:80")
-
-ggplot(dat, aes(x, y - 80, group = factor(y))) + geom_line() + coord_polar()
-save_vtest("Concentric circles at theta = 1:80 - 80")
-
-ggplot(dat, aes(x, y - 40, group = factor(y))) + geom_line() + coord_polar()
-save_vtest("Concentric circles at theta = 1:80 - 40")
-
-ggplot(dat, aes(x, y + 100, group = factor(y))) + geom_line() + coord_polar()
-save_vtest("Concentric circles at theta = 1:80 + 100")
-
-ggplot(dat, aes(x, y * 100, group = factor(y))) + geom_line() + coord_polar()
-save_vtest("Concentric circles at theta = 1:80 * 100")
-
-
-dat <- data.frame(
- theta = c(0, 2*pi, 2, 6, 6, 1, 1, 0),
- r = c(0, 0, 0.5, 0.5, 1, 1, 0.75, .5),
- g = 1:8)
-ggplot(dat, aes(theta, r, colour = g)) + geom_path() +
- geom_point(alpha = 0.3, colour = "black") + coord_polar()
-save_vtest("Rays, circular arcs, and spiral arcs")
-
-
-dat <- data.frame(x = LETTERS[1:6], y = 11:16)
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar()
-save_vtest("rose plot with has equal spacing")
-
-ggplot(dat, aes(as.numeric(x), y)) + geom_point() + coord_polar()
-save_vtest("continuous theta has merged low/high values")
-
-ggplot(dat, aes(as.numeric(x), y)) + geom_point() + coord_polar() +
- xlim(0, 6) + ylim(0,16)
-save_vtest("continuous theta with xlim(0, 6) and ylim(0, 16)")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar(theta = "y")
-save_vtest("racetrack plot with expand=F is closed and doesn't have center hole")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") + coord_polar(theta = "y") +
- scale_x_discrete(expand = c(0, 0.6))
-save_vtest("racetrack plot with expand=T is closed and has center hole")
-
-end_vcontext()
diff --git a/visual_test/dotplot.r b/visual_test/dotplot.r
deleted file mode 100644
index 81f76ef4b..000000000
--- a/visual_test/dotplot.r
+++ /dev/null
@@ -1,146 +0,0 @@
-vcontext("dotplot")
-
-set.seed(112)
-dat <- data.frame(x = rnorm(20), g = LETTERS[1:2])
-
-# Basic dotplot with binning along x axis
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4)
-save_vtest("basic dotplot with dot-density binning, binwidth = .4")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, method = "histodot")
-save_vtest("histodot binning (equal bin spacing)")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackratio = .5, fill = "white")
-save_vtest("dots stacked closer: stackratio=.5, fill=white")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, dotsize = 1.4, fill = "white")
-save_vtest("larger dots: dotsize=1.5, fill=white")
-
-
-# Stacking methods
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up")
-save_vtest("stack up")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down")
-save_vtest("stack down")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center")
-save_vtest("stack center")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole")
-save_vtest("stack centerwhole")
-
-
-# Stacking methods with coord_flip
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "up") + coord_flip()
-save_vtest("stack up with coord_flip")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "down") + coord_flip()
-save_vtest("stack down with coord_flip")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "center") + coord_flip()
-save_vtest("stack center with coord_flip")
-
-ggplot(dat, aes(x)) + geom_dotplot(binwidth = .4, stackdir = "centerwhole") + coord_flip()
-save_vtest("stack centerwhole with coord_flip")
-
-
-# Binning along x, with groups
-ggplot(dat, aes(x, fill = g)) + geom_dotplot(binwidth = .4, alpha = .4)
-save_vtest("multiple groups, bins not aligned")
-
-ggplot(dat, aes(x, fill = g)) +
- geom_dotplot(binwidth = .4, alpha = .4, binpositions = "all")
-save_vtest("multiple groups, bins aligned")
-
-
-# Binning along y axis
-ggplot(dat, aes(0, x)) +
- geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
-save_vtest("bin along y, stack center")
-
-ggplot(dat, aes(0, x)) +
- geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole")
-save_vtest("bin along y, stack centerwhole")
-
-ggplot(dat, aes(0, x)) +
- geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "centerwhole", method = "histodot")
-save_vtest("bin along y, stack centerwhole, histodot")
-
-
-# Binning along y, with multiple grouping factors
-dat2 <- data.frame(x = LETTERS[1:3], y = rnorm(90), g = LETTERS[1:2])
-
-ggplot(dat2, aes(x, y)) +
- geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "centerwhole")
-save_vtest("bin y, three x groups, stack centerwhole")
-
-ggplot(dat2, aes(x, y)) +
- geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all")
-save_vtest("bin y, three x groups, bins aligned across groups")
-
-ggplot(dat2, aes(x, y)) +
- geom_dotplot(binwidth = .25, binaxis = "y", stackdir = "center", binpositions = "all") +
- coord_flip()
-save_vtest("bin y, three x groups, bins aligned, coord_flip")
-
-ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
- geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center")
-save_vtest("bin y, dodged")
-
-ggplot(dat2, aes("foo", y, fill = x)) + scale_y_continuous(breaks = seq(-4, 4, .4)) +
- geom_dotplot(binwidth = .25, position = "dodge", binaxis = "y", stackdir = "center") +
- coord_flip()
-save_vtest("bin y, dodged, coord_flip")
-
-
-ggplot(dat2, aes(x, y, fill = g)) + scale_y_continuous(breaks = seq(-4 ,4, .4)) +
- geom_dotplot(binwidth = .2, position = "dodge", binaxis = "y", stackdir = "center")
-save_vtest("bin y, three x groups, fill and dodge")
-
-ggplot(dat2, aes(as.numeric(x), y, group = x)) +
- geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
-save_vtest("bin y, continous x-axis, grouping by x")
-
-ggplot(dat2, aes(as.numeric(x), y)) +
- geom_dotplot(binwidth = .2, binaxis = "y", stackdir = "center")
-save_vtest("bin y, continous x-axis, single x group")
-
-
-# Stacking groups
-ggplot(dat2, aes(y, fill = x)) +
- geom_dotplot(binwidth = .25, stackgroups = TRUE, binpositions = "all", alpha = 0.5)
-save_vtest("stackgroups with 3 groups, dot-density with aligned bins")
-
-ggplot(dat2, aes(y, fill = x)) +
- geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
-save_vtest("stackgroups with 3 groups, histodot")
-
-ggplot(dat2, aes(1, y, fill = x)) +
- geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5)
-save_vtest("stackgroups with 3 groups, bin y, histodot")
-
-# This one is currently broken but it would be a really rare case, and it
-# probably requires a really ugly hack to fix
-ggplot(dat2, aes(x, y, fill = g)) +
- geom_dotplot(binaxis = "y", binwidth = .25, stackgroups = TRUE, method = "histodot",
- alpha = 0.5, stackdir = "centerwhole")
-save_vtest("bin y, dodging, stackgroups with 3 groups, histodot (currently broken)")
-
-ggplot(dat2, aes(y, fill = g)) +
- geom_dotplot(binwidth = .25, stackgroups = TRUE, method = "histodot", alpha = 0.5) +
- facet_grid(x ~ .)
-save_vtest("facets, 3 groups, histodot, stackgroups")
-
-# Missing values
-dat2 <- dat
-dat2$x[c(1, 10)] <- NA
-
-ggplot(dat2, aes(x)) + geom_dotplot(binwidth = .4)
-save_vtest("2 NA values, dot-density binning, binwidth = .4")
-
-ggplot(dat2, aes(0, x)) +
- geom_dotplot(binwidth = .4, binaxis = "y", stackdir = "center")
-save_vtest("2 NA values, bin along y, stack center")
-
-end_vcontext()
diff --git a/visual_test/geom-path.r b/visual_test/geom-path.r
deleted file mode 100644
index 44e80c83d..000000000
--- a/visual_test/geom-path.r
+++ /dev/null
@@ -1,24 +0,0 @@
-vcontext("geom-path")
-set.seed(1)
-
-nCategory <- 5
-nItem <- 6
-df <- data.frame(category = rep(LETTERS[1:nCategory], 1, each = nItem),
- item = paste("Item#", rep(1:nItem, nCategory, each = 1), sep = ''),
- value = rep(1:nItem, nCategory, each = 1) + runif(nCategory * nItem) * 0.8)
-
-df2 <- df[c(1, 2, 7, 8, 13, 14, 3:6, 9:12, 15:nrow(df)), ]
-
-ggplot(df) + geom_path(aes(x = value, y = category, group = item))
-save_vtest("lines")
-
-ggplot(df2) + geom_path(aes(x = value, y = category, group = item))
-save_vtest("lines with changed data order, should have same appearance")
-
-ggplot(df) + geom_path(aes(x = value, y = category, group = item, colour = item))
-save_vtest("lines, colour")
-
-ggplot(df2) + geom_path(aes(x = value, y = category, group = item, colour = item))
-save_vtest("lines, colour, with changed data order, should have same appearance")
-
-end_vcontext()
diff --git a/visual_test/geom-polygon.r b/visual_test/geom-polygon.r
deleted file mode 100644
index e4c3702cd..000000000
--- a/visual_test/geom-polygon.r
+++ /dev/null
@@ -1,13 +0,0 @@
-vcontext("geom-polygon")
-
-ggplot(faithful, aes(x = eruptions, y = waiting)) +
- stat_density_2d(aes(colour = ..level..), geom = "path") +
- xlim(0.5, 6) + ylim(40, 110)
-save_vtest("stat_density2d with paths")
-
-ggplot(faithful, aes(x = eruptions, y = waiting)) +
- stat_density2d(aes(fill = ..level..), geom = "polygon", colour = "white") +
- xlim(0.5, 6) + ylim(40, 110)
-save_vtest("stat_density2d with filled polygons")
-
-end_vcontext()
diff --git a/visual_test/geom-raster.r b/visual_test/geom-raster.r
deleted file mode 100644
index 415c19687..000000000
--- a/visual_test/geom-raster.r
+++ /dev/null
@@ -1,55 +0,0 @@
-vcontext("geom-raster")
-set.seed(1)
-
-# 3 x 2 ----------------------------------------------------------------------
-df <- data.frame(x = rep(c(-1, 1), each = 3), y = rep(-1:1, 2), z = 1:6)
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
-save_vtest("3 x 2")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
- xlim(-2, 2) + ylim(-2, 2)
-save_vtest("3 x 2, set limits")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
- geom_point(colour = "red")
-save_vtest("3 x 2, just = (0, 0)")
-
-# 1 x 3 ----------------------------------------------------------------------
-df <- data.frame(x = -1:1, y = 0, z = 1:3)
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
-save_vtest("1 x 3")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
- xlim(-2, 2) + ylim(-2, 2)
-save_vtest("1 x 3, set limits")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
- geom_point(colour = "red")
-save_vtest("1 x 3, just = (0, 0)")
-
-# 3 x 1 ----------------------------------------------------------------------
-
-df <- data.frame(x = 0, y = -1:1, z = 1:3)
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red")
-save_vtest("3 x 1")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster() + geom_point(colour = "red") +
- xlim(-2, 2) + ylim(-2, 2)
-save_vtest("3 x 1, set limits")
-
-ggplot(df, aes(x, y, fill = z)) + geom_raster(hjust = 0, vjust = 0) +
- geom_point(colour = "red")
-save_vtest("3 x 1, just = (0, 0)")
-
-# Categorical fill, irregular swatches ---------------------------------------
-
-df <- expand.grid(x = 1:10, y = 1:10)
-df$col <- (df$x + df$y) %% 2
-df$col[df$x == 5 & df$col == 1] <- NA
-df$col[df$y == 5 & df$col == 0] <- NA
-qplot(x, y, data = df, fill = factor(col), geom = "raster")
-save_vtest("irregular categorical")
-
-end_vcontext()
diff --git a/visual_test/guide-axis.r b/visual_test/guide-axis.r
deleted file mode 100644
index 1be398cb3..000000000
--- a/visual_test/guide-axis.r
+++ /dev/null
@@ -1,19 +0,0 @@
-vcontext("guide-axis")
-
-## align the labels for facets
-
-qplot(hwy, reorder(model, hwy), data = mpg) +
- facet_grid(manufacturer ~ ., scales = "free", space = "free") +
- theme(strip.text.y = element_text(angle = 0))
-save_vtest("align facet labels, facets horizontal")
-
-qplot(reorder(model, hwy), hwy, data = mpg) +
- facet_grid(. ~ manufacturer, scales = "free", space = "free") +
- theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5))
-save_vtest("align facet labels, facets vertical")
-
-qplot(wt, mpg, data = mtcars) +
- theme(axis.line = element_line(size = 5, lineend = "square"))
-save_vtest("thick axis lines")
-
-end_vcontext()
diff --git a/visual_test/guide-position.r b/visual_test/guide-position.r
deleted file mode 100644
index bd4519635..000000000
--- a/visual_test/guide-position.r
+++ /dev/null
@@ -1,62 +0,0 @@
-vcontext("guide-position")
-
-p1 <- ggplot(mtcars, aes(mpg, disp, colour = cyl)) +
- geom_point() +
- labs(title = "title of plot") +
- theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) +
- scale_x_continuous(breaks = mean(mtcars$mpg), labels = "very very long long axis label") +
- scale_y_continuous(breaks = mean(mtcars$disp), labels = "very very long long axis label")
-
-p1 + theme(legend.position = "left")
-save_vtest("legend on left")
-p1 + theme(legend.position = "bottom")
-save_vtest("legend on bottom")
-p1 + theme(legend.position = "right")
-save_vtest("legend on right")
-p1 + theme(legend.position = "top")
-save_vtest("legend on top")
-
-p1 + facet_grid(am~vs) + theme(legend.position = "left")
-save_vtest("facet_grid, legend on left")
-p1 + facet_grid(am~vs) + theme(legend.position = "bottom")
-save_vtest("facet_grid, legend on bottom")
-p1 + facet_grid(am~vs) + theme(legend.position = "right")
-save_vtest("facet_grid, legend on right")
-p1 + facet_grid(am~vs) + theme(legend.position = "top")
-save_vtest("facet_grid, legend on top")
-
-p1 + facet_wrap(am~vs) + theme(legend.position = "left")
-save_vtest("facet_wrap, legend on left")
-p1 + facet_wrap(am~vs) + theme(legend.position = "bottom")
-save_vtest("facet_wrap, legend on bottom")
-p1 + facet_wrap(am~vs) + theme(legend.position = "right")
-save_vtest("facet_wrap, legend on right")
-p1 + facet_wrap(am~vs) + theme(legend.position = "top")
-save_vtest("facet_wrap, legend on top")
-
-# padding
-dat <- data.frame(x = LETTERS[1:3], y = 1)
-p2 <- ggplot(dat, aes(x, y, fill = x, colour = 1:3)) +
- geom_bar(stat = "identity") +
- theme(legend.background = element_rect(colour = "black")) +
- guides(color = "colorbar")
-p2
-save_vtest("padding in legend box")
-
-
-# Placement of legend inside
-p2 + theme(legend.position = c(.5, .5))
-save_vtest("legend inside plot, centered")
-
-p2 + theme(legend.justification = c(0,0), legend.position = c(0,0))
-save_vtest("legend inside plot, bottom left")
-
-p2 + theme(legend.justification = c(1,1), legend.position = c(1,1))
-save_vtest("legend inside plot, top right")
-
-p2 + theme(legend.justification = c(0,0), legend.position = c(.5,.5))
-save_vtest("legend inside plot, bottom left of legend at center")
-
-
-
-end_vcontext()
diff --git a/visual_test/lines.r b/visual_test/lines.r
deleted file mode 100644
index 0977d76b7..000000000
--- a/visual_test/lines.r
+++ /dev/null
@@ -1,99 +0,0 @@
-vcontext("lines")
-
-dat <- data.frame(x = LETTERS[1:5], y = 1:5)
-
-# geom_abline tests
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_abline(intercept = 2, slope = 0, colour = "red")
-save_vtest("geom_abline: intercept=2, slope=0")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_abline(intercept = 0, slope = 1, colour = "red")
-save_vtest("geom_abline: intercept=0, slope=1 Should have same values as bars")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_abline(intercept = 2, slope = 0, colour = "red") +
- coord_flip()
-save_vtest("geom_abline, coord_flip: intercept=2, slope=0")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_abline(intercept = 0, slope = 1, colour = "red") +
- coord_flip()
-save_vtest("geom_abline, coord_flip: intercept=0, slope=1, should have same values as bars")
-
-
-# geom_hline tests
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_hline(yintercept = 2, colour = "red")
-save_vtest("geom_hline: intercept=2")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_hline(yintercept = 2, colour = "red") +
- coord_flip()
-save_vtest("geom_hline, coord_flip: intercept=2")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_hline(yintercept = 2, colour = "red") +
- coord_polar()
-save_vtest("geom_hline, coord_polar: intercept=2, should have a circle at r=2")
-
-
-# geom_vline tests
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_vline(xintercept = 2, colour = "red")
-save_vtest("geom_vline: intercept=2")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_vline(xintercept = 2, colour = "red") +
- coord_flip()
-save_vtest("geom_vline, coord_flip: intercept=2")
-
-ggplot(dat, aes(x, y)) + geom_bar(stat = "identity") +
- geom_vline(xintercept = 2, colour = "red") +
- coord_polar()
-save_vtest("geom_vline, coord_polar: intercept=2, should have a ray at 2")
-
-
-# hline, vline, and abline tests with coord_map
-library(maps)
-library(mapproj)
-
-nz <- data.frame(map("nz", plot = FALSE)[c("x", "y")])
-nzmap <- qplot(x, y, data = nz, geom = "path")
-
-nzmap + geom_hline(yintercept = -45) + coord_map()
-save_vtest("geom_hline: intercept=-45, projection=mercator")
-
-nzmap + geom_vline(xintercept = 172) + coord_map()
-save_vtest("geom_vline: intercept=172, projection=mercator")
-
-nzmap + geom_abline(intercept = 130, slope = -1) + coord_map()
-save_vtest("geom_abline: intercept=130, slope=-1 projection=mercator")
-
-
-nzmap + geom_hline(yintercept = -45) + coord_map(projection = "cylindrical")
-save_vtest("geom_hline: intercept=-45, projection=cylindrical")
-
-nzmap + geom_vline(xintercept = 172) + coord_map(projection = "cylindrical")
-save_vtest("geom_vline: intercept=172, projection=cylindrical")
-
-nzmap + geom_abline(intercept = 130, slope = -1) + coord_map(projection = "cylindrical")
-save_vtest("geom_abline: intercept=130, slope=-1, projection=cylindrical")
-
-
-nzmap + geom_hline(yintercept = -45) +
- coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
-save_vtest("geom_hline: intercept=-45, projection=azequalarea")
-
-nzmap + geom_vline(xintercept = 172) +
- coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
-save_vtest("geom_vline: intercept=172, projection=azequalara")
-
-nzmap + geom_abline(intercept = 130, slope = -1) +
- coord_map(projection = 'azequalarea', orientation = c(-36.92, 174.6, 0))
-save_vtest("geom_abline: intercept=130, slope=-1, projection=azequalarea")
-
-end_vcontext()
diff --git a/visual_test/minor-breaks.r b/visual_test/minor-breaks.r
deleted file mode 100644
index a08fb9855..000000000
--- a/visual_test/minor-breaks.r
+++ /dev/null
@@ -1,41 +0,0 @@
-vcontext("minor-breaks")
-p <- ggplot(NULL, aes(1:3, 1:3)) + geom_point() +
- scale_x_continuous(breaks = 1:3, minor_breaks = c(1.25, 2.75)) +
- scale_y_continuous(breaks = 1:3, minor_breaks = c(1.25, 2.75))
-
-p
-save_vtest("manual minor breaks")
-p + coord_polar()
-save_vtest("manual minor breaks with coord_polar")
-
-
-set.seed(342)
-df <- data.frame(
- date = seq(as.Date("2012-2-29"), length.out = 100, by = "1 day")[sample(100, 50)],
- price = runif(50)
-)
-df <- df[order(df$date), ]
-library(scales)
-p <- qplot(date, price, data = df, geom = "line") +
- scale_x_date(
- labels = date_format("%m/%d"),
- breaks = date_breaks("month"),
- minor_breaks = date_breaks("week")
- )
-
-p
-save_vtest("major breaks: months, minor breaks: weeks")
-
-p + coord_polar()
-save_vtest("major breaks: months, minor breaks: weeks, with coord_polar")
-
-ggplot(NULL, aes(letters[1:3], 1:3)) + geom_point()
-save_vtest("default breaks")
-
-qplot(1:1e4, 1:1e4) + scale_x_continuous(trans = log2_trans()) + scale_y_log10()
-save_vtest("scale_x_continuous(trans = log2_trans()) + scale_y_log10")
-
-qplot(1:5, 1:5) + scale_x_continuous(trans = exp_trans(2)) + scale_y_continuous(trans = exp_trans(2))
-save_vtest("scale_x_continuous(trans = exp_trans(2)) + scale_y_continuous(trans = exp_trans(2))")
-
-end_vcontext()
diff --git a/visual_test/scale-breaks.r b/visual_test/scale-breaks.r
deleted file mode 100644
index 1bb8b51d5..000000000
--- a/visual_test/scale-breaks.r
+++ /dev/null
@@ -1,23 +0,0 @@
-vcontext("scale-breaks")
-dat <- data.frame(x = 1:3, y = 1:3)
-
-
-ggplot(dat, aes(x = x, y = y)) + geom_point() + scale_x_continuous(breaks = NULL)
-save_vtest("no x breaks")
-
-ggplot(dat, aes(x = x, y = y)) + geom_point() + scale_y_continuous(breaks = NULL)
-save_vtest("no y breaks")
-
-ggplot(dat, aes(x = 1, y = y, alpha = x)) + geom_point() + scale_alpha_continuous(breaks = NULL)
-save_vtest("no alpha breaks (no legend)")
-
-ggplot(dat, aes(x = 1, y = y, size = x)) + geom_point() + scale_size_continuous(breaks = NULL)
-save_vtest("no size breaks (no legend)")
-
-ggplot(dat, aes(x = 1, y = y, fill = x)) + geom_point(shape = 21) + scale_fill_continuous(breaks = NULL)
-save_vtest("no fill breaks (no legend)")
-
-ggplot(dat, aes(x = 1, y = y, colour = x)) + geom_point() + scale_colour_continuous(breaks = NULL)
-save_vtest("no colour breaks (no legend)")
-
-end_vcontext()
diff --git a/visual_test/scale-date.r b/visual_test/scale-date.r
deleted file mode 100644
index cf7f37827..000000000
--- a/visual_test/scale-date.r
+++ /dev/null
@@ -1,32 +0,0 @@
-vcontext("scale-date")
-
-set.seed(321)
-df <- data.frame(
- dx = seq(as.Date("2012-02-29"), length.out = 100, by = "1 day")[sample(100, 50)],
- price = runif(50)
-)
-df <- df[order(df$dx), ]
-
-dt <- qplot(dx, price, data = df, geom = "line")
-dt
-save_vtest("dates along x, default breaks")
-dt + scale_x_date(breaks = date_breaks("2 weeks"))
-save_vtest("scale_x_date(breaks = date_breaks(\"2 weeks\"))")
-dt + scale_x_date(date_breaks = "3 weeks")
-save_vtest("scale_x_date(breaks = \"3 weeks\")")
-
-dt + scale_x_date(labels = date_format("%m/%d"))
-save_vtest("scale_x_date(labels = date_format(\"%m/%d\"))")
-
-dt + scale_x_date(labels = date_format("%W"), "week")
-save_vtest("scale_x_date(labels = date_format(\"%W\"), \"week\")")
-
-dt <- qplot(price, dx, data = df, geom = "line")
-dt
-save_vtest("dates along y, default breaks")
-dt + scale_y_date(breaks = date_breaks("2 weeks"))
-save_vtest("scale_y_date(breaks = date_breaks(\"2 weeks\"))")
-dt + scale_y_date(date_breaks = "3 weeks")
-save_vtest("scale_y_date(breaks = \"3 weeks\")")
-
-end_vcontext()
diff --git a/visual_test/stat-summary.r b/visual_test/stat-summary.r
deleted file mode 100644
index ab184c655..000000000
--- a/visual_test/stat-summary.r
+++ /dev/null
@@ -1,28 +0,0 @@
-vcontext("stat-summary")
-
-ggplot(mtcars, aes(x = cyl, y = mpg, colour = factor(vs))) +
- geom_point() +
- stat_summary(fun.y = mean, geom = "line", size = 2)
-save_vtest("summary with color and lines")
-
-ggplot(mtcars, aes(x = cyl, y = mpg)) +
- geom_point() +
- stat_summary(
- fun.data = mean_cl_boot,
- colour = "red",
- geom = "crossbar",
- width = 0.2
- )
-save_vtest("summary with crossbars, no grouping")
-
-ggplot(mtcars, aes(x = cyl, y = mpg, group = cyl)) +
- geom_point() +
- stat_summary(
- fun.data = mean_cl_boot,
- colour = "red",
- geom = "crossbar",
- width = 0.2
- )
-save_vtest("summary with crossbars, manual grouping")
-
-end_vcontext()
diff --git a/visual_test/themes.r b/visual_test/themes.r
deleted file mode 100644
index c70fa66fe..000000000
--- a/visual_test/themes.r
+++ /dev/null
@@ -1,80 +0,0 @@
-vcontext("themes")
-library(grid)
-
-p <- qplot(1:3, 1:3)
-
-
-# Tests for adding theme objects together
-# Some of these add directly to ggplot object; others add to theme object first
-
-p + theme_bw() + theme(text = element_text(colour = 'blue'))
-save_vtest("theme_bw() plus blue text")
-
-t <- theme_bw() + theme(text = element_text(colour = 'blue'))
-p + t
-save_vtest("add saved theme object with theme_bw() plus blue text")
-
-
-
-p + theme(text = element_text(colour = 'blue')) + theme_bw()
-save_vtest("blue text plus theme_bw() - result is black text")
-
-t <- theme(text = element_text(colour = 'blue')) + theme_bw()
-p + t
-save_vtest("add saved theme object with blue text plus theme_bw()) - result is black text")
-
-
-
-p + theme(text = element_text(colour = 'blue', face = 'italic'))
-save_vtest("add blue and italic in single element object")
-
-
-p + theme(
- text = element_text(colour = 'blue')) +
- theme(text = element_text(face = 'italic')
-)
-save_vtest("add blue and italic in separate element objects")
-
-p + theme(
- text = element_text(colour = 'blue'),
- text = element_text(face = 'italic')
-)
-save_vtest("add blue and italic in one theme object with two 'text' elements - result is blue only")
-
-
-
-# Inheritance tests
-
-p + theme_bw(base_size = 24, base_family = "Times") + labs(title = "Title text here")
-save_vtest('add theme_bw(base_size=24, base_family="Times")')
-
-
-p + theme_bw() +
- theme(axis.title = element_text(size = rel(2), colour = 'blue')) +
- theme(axis.title.x = element_text(size = rel(2)))
-save_vtest("axis title text is blue, compounded relative sizing")
-
-
-# Next two tests contrast the + operator with the %+replace% operator
-t <- theme_bw() + theme(axis.title.y = element_text(size = rel(2)))
-p + t
-save_vtest("theme_bw + larger relative size for axis.title.y")
-
-t <- theme_bw() %+replace% theme(axis.title.y = element_text(size = rel(2)))
-p + t
-save_vtest("theme_bw %+replace% larger relative size for axis.title.y - result is angle=0")
-
-
-t <- theme_bw() + theme(text = element_blank())
-p + t
-save_vtest("text is element_blank - result is no text")
-
-
-# Testing specific elements
-p + theme(axis.text = element_blank(), axis.ticks = element_blank(),
- axis.title = element_blank(),
- plot.background = element_rect(fill = "lightblue"),
- panel.border = element_rect(colour = "black", size = 4, fill = NA))
-save_vtest("many blank items, and light blue plot background")
-
-end_vcontext()
diff --git a/visual_test/violin.r b/visual_test/violin.r
deleted file mode 100644
index 801d1676e..000000000
--- a/visual_test/violin.r
+++ /dev/null
@@ -1,57 +0,0 @@
-vcontext("violin")
-
-set.seed(111)
-dat <- data.frame(x = LETTERS[1:3], y = rnorm(90))
-dat <- dat[dat$x != "C" | c(T, F),] # Keep half the C's
-
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin()
-save_vtest("basic")
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin(scale = "count")
-save_vtest("scale area to sample size (C is smaller)")
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin(width = .5)
-save_vtest("narrower (width=.5)")
-
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin(trim = FALSE) + geom_point(shape = 21)
-save_vtest("with tails and points")
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin(adjust = .3) + geom_point(shape =
- 21)
-save_vtest("with smaller bandwidth and points")
-
-
-ggplot(dat, aes(x = "foo", y = y, fill = x)) + geom_violin()
-save_vtest("dodging")
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin() + coord_polar()
-save_vtest("coord_polar")
-
-ggplot(dat, aes(x = x, y = y)) + geom_violin() + coord_flip()
-save_vtest("coord_flip")
-
-ggplot(dat, aes(x = "foo", y = y, fill = x)) + geom_violin() + coord_flip()
-save_vtest("dodging and coord_flip")
-
-ggplot(dat, aes(x = as.numeric(x), y = y)) + geom_violin()
-save_vtest("continuous x axis, multiple groups (center should be at 2.0)")
-
-ggplot(dat, aes(x = as.numeric(1), y = y)) + geom_violin()
-save_vtest("continuous x axis, single group (center should be at 1.0)")
-
-
-ggplot(dat, aes(x=x, y=y)) + geom_violin(draw_quantiles=c(0.25,0.5,0.75))
-save_vtest("quantiles")
-
-dat2 <- data.frame(x = LETTERS[1:3], y = rnorm(90), g = letters[5:6])
-
-ggplot(dat2, aes(x = x, y = y, fill = g)) + geom_violin()
-save_vtest("grouping on x and fill")
-
-ggplot(dat2, aes(x = x, y = y, fill = g)) +
- geom_violin(position = position_dodge(width = .5))
-save_vtest("grouping on x and fill, dodge width = 0.5")
-
-end_vcontext()