Skip to content

Commit a09814b

Browse files
committed
Improve and approve new palmerpenguin visual baselines. Also make sure docker container installs dependencies at run-time
1 parent 273b1ed commit a09814b

34 files changed

+40
-41
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ revdep/
1818
travis_debug.R
1919
.httr-oauth
2020
tests/testthat/Rplots.pdf
21+
inst/examples/shiny/event_data/tests/shinytest/mytest-current/

inst/docker/Dockerfile.vtest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ RUN R -e "remotes::install_github('r-lib/vdiffr')"
9595
# install any new dependencies, then either manage cases (the default) or run tests
9696
# note the workaround to get docker to run a proper exit status when there are testthat errors
9797
# https://github.com/r-lib/testthat/issues/515#issuecomment-304169376
98-
CMD R -e "remotes::install_deps(dependencies = TRUE)"
9998

100-
CMD cd /home/plotly; R -e "if (!identical(Sys.getenv('VMODE'), 'ci')) vdiffr::manage_cases(); \
99+
CMD cd /home/plotly; R -e "remotes::install_deps(dependencies = T); \
100+
if (!identical(Sys.getenv('VMODE'), 'ci')) vdiffr::manage_cases(); \
101101
res <- devtools::test(reporter='summary'); \
102102
df <- as.data.frame(res); \
103103
if (sum(df\$failed) > 0 || any(df\$error)) q(status=1)"

tests/figs/density2d/density2d.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-background.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-panel-border-1.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-panel-border-2.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-ticks-and-grids.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-ticks-default.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/ggplot-themes/theme-zeroline-default.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/labels/labels-angles.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/labels/labels-ggtitle.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/labels/labels-scale-x-continuous-name.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/labels/labels-ylab.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/labels/labs-element-blank.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/legends/legend-hide-legend.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/legends/legend-one-entry.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-color-factor-custom.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-color-factor-custom2.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-color-factor.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-color-numeric-custom.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-color-numeric.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-color/plotly-color-scatterplot-scatter3d-axes.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-symbol/plotly-symbol-scatterplot-symbol.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly-symbol/plotly-symbol-scatterplot-symbol2.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly/plotly-bar-inference.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/plotly/plotly-scatterplot.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/size/size-is-a-vector.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/subplot/plotly-subplot-group.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/thematic/thematic-geom-and-theme-defaults.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/thematic/thematic-qualitative.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/figs/thematic/thematic-sequential.svg

Lines changed: 1 addition & 1 deletion
Loading

tests/testthat/test-ggplot-theme.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
context("ggplot themes")
22

33
penguin.base <- ggplot(palmerpenguins::penguins) +
4-
geom_point(aes(bill_length_mm, bill_length_mm)) +
4+
geom_point(aes(bill_length_mm, flipper_length_mm)) +
55
theme_grey()
66

77
test_that("background translated correctly",{

tests/testthat/test-plotly-color.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ expect_traces <- function(p, n.traces, name){
88
}
99

1010
test_that("plot_ly() handles a simple scatterplot", {
11-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm, color = ~bill_depth_mm)
11+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm, color = ~bill_depth_mm)
1212
})
1313

1414
test_that("Mapping a factor variable to color works", {
15-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm, color = ~species)
15+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm, color = ~species)
1616
l <- expect_traces(p, 3, "scatterplot-color-factor")
1717
markers <- lapply(l$data, "[[", "marker")
1818
cols <- unlist(lapply(markers, "[[", "color"))
@@ -24,15 +24,15 @@ test_that("Custom RColorBrewer pallette works for factor variable", {
2424
# convert hex to rgba spec for comparison's sake
2525
colsToCompare <- toRGB(cols)
2626
# specifying a pallette set should "span the gamut"
27-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm, color = ~species,
27+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm, color = ~species,
2828
colors = "Set1")
2929
l <- expect_traces(p, 3, "scatterplot-color-factor-custom")
3030
markers <- lapply(l$data, "[[", "marker")
3131
colz <- unlist(lapply(markers, "[[", "color"))
3232
idx <- if (packageVersion("scales") > '1.0.0') c(1, 2, 3) else c(1, 5, 9)
3333
expect_identical(sort(colsToCompare[idx]), sort(colz))
3434
# providing vector of RGB codes should also work
35-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm, color = ~species,
35+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm, color = ~species,
3636
colors = cols[1:3])
3737
l <- expect_traces(p, 3, "scatterplot-color-factor-custom2")
3838
markers <- lapply(l$data, "[[", "marker")
@@ -51,7 +51,7 @@ test_that("Passing hex codes to colors argument works", {
5151
})
5252

5353
test_that("Mapping a numeric variable to color works", {
54-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm, color = ~bill_depth_mm)
54+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm, color = ~bill_depth_mm)
5555
# one trace is for the colorbar
5656
l <- expect_traces(p, 2, "scatterplot-color-numeric")
5757
idx <- vapply(l$data, is.colorbar, logical(1))
@@ -76,7 +76,7 @@ test_that("color/stroke mapping with box translates correctly", {
7676
})
7777

7878
test_that("Custom RColorBrewer pallette works for numeric variable", {
79-
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~bill_length_mm,
79+
p <- plot_ly(palmerpenguins::penguins, x = ~bill_length_mm, y = ~flipper_length_mm,
8080
color = ~bill_depth_mm, colors = "Greens")
8181
# one trace is for the colorbar
8282
l <- expect_traces(p, 2, "scatterplot-color-numeric-custom")

tests/testthat/test-plotly-subplot.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ test_that("subplot accepts a list of plots", {
136136

137137
test_that("ggplotly understands ggmatrix", {
138138
skip_if_not_installed("GGally")
139-
penguins <- palmerpenguins::penguins %>% tidyr::drop_na() %>%
140-
select(species, bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g)
141-
L <- expect_doppelganger_built(GGally::ggpairs(penguins),
139+
L <- expect_doppelganger_built(GGally::ggpairs(iris),
142140
"plotly-subplot-ggmatrix")
143141
})
144142

0 commit comments

Comments
 (0)