Skip to content

Commit 2d400cf

Browse files
authored
Merge pull request #1256 from ropensci/ggplot2-cran
drop ggplot2 2.2.1 support (i.e., require most recent CRAN release)
2 parents a76100d + 44eb2dd commit 2d400cf

12 files changed

+51
-579
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CONDUCT.md
66
CONTRIBUTING.md
77
build_site.R
88
travis_debug.R
9+
revdep_email.R
910
todo.R
1011
.github/
1112
inst/examples/rmd/*.html
@@ -17,3 +18,4 @@ revdep/
1718
^LICENSE\.md$
1819
README.Rmd
1920
abbvie.R
21+
^\.httr-oauth$

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Rapp.history
66
*.DS_Store
77
node_modules/
88
build_site.R
9+
revdep_email.R
910
abbvie.R
1011
todo.R
1112
inst/examples/rmd/*.html
@@ -15,3 +16,4 @@ Untitled*
1516
rsconnect/
1617
revdep/
1718
travis_debug.R
19+
.httr-oauth

DESCRIPTION

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ URL: https://plot.ly/r, https://cpsievert.github.io/plotly_book/, https://github
2222
BugReports: https://github.com/ropensci/plotly/issues
2323
Depends:
2424
R (>= 3.2.0),
25-
ggplot2 (>= 2.2.1)
25+
ggplot2 (>= 3.0.0)
2626
Imports:
2727
tools,
2828
scales,
@@ -72,8 +72,6 @@ Suggests:
7272
plotlyGeoAssets,
7373
rstudioapi,
7474
forcats
75-
Remotes:
76-
tidyverse/ggplot2
7775
LazyData: true
7876
RoxygenNote: 6.0.1.9000
7977
Encoding: UTF-8

R/ggplotly-legacy.R

Lines changed: 0 additions & 534 deletions
This file was deleted.

R/ggplotly.R

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,6 @@ gg2list <- function(p, width = NULL, height = NULL,
210210
)
211211
}
212212

213-
# we currently support ggplot2 >= 2.2.1 (see DESCRIPTION)
214-
# there are too many naming changes in 2.2.1.9000 to realistically
215-
if (!is_dev_ggplot2()) {
216-
message(
217-
"We recommend that you use the dev version of ggplot2 with `ggplotly()`\n",
218-
"Install it with: `devtools::install_github('tidyverse/ggplot2')`"
219-
)
220-
if (!identical(dynamicTicks, FALSE)) {
221-
warning(
222-
"You need the dev version of ggplot2 to use `dynamicTicks`", call. = FALSE
223-
)
224-
}
225-
return(
226-
gg2list_legacy(
227-
p, width = width, height = height, tooltip = tooltip,
228-
layerData = layerData, originalData = originalData, source = source, ...
229-
)
230-
)
231-
}
232-
233213
# ------------------------------------------------------------------------
234214
# Our internal version of ggplot2::ggplot_build(). Modified from
235215
# https://github.com/hadley/ggplot2/blob/0cd0ba/R/plot-build.r#L18-L92
@@ -264,8 +244,7 @@ gg2list <- function(p, width = NULL, height = NULL,
264244
# save the domain of the group for display in tooltips
265245
groupDomains <- Map(function(x, y) {
266246
aes_g <- y$mapping[["group"]] %||% plot$mapping[["group"]]
267-
eval_ <- if (is_dev_ggplot2()) rlang::eval_tidy else base::eval
268-
tryNULL(eval_(aes_g, x))
247+
tryNULL(rlang::eval_tidy(aes_g, x))
269248
}, data, layers)
270249

271250
# for simple (StatIdentity) geoms, add crosstalk key to aes mapping
@@ -1295,10 +1274,6 @@ rect2shape <- function(rekt = ggplot2::element_rect()) {
12951274
)
12961275
}
12971276

1298-
is_dev_ggplot2 <- function() {
1299-
packageVersion("ggplot2") > "2.2.1"
1300-
}
1301-
13021277
# We need access to internal ggplot2 functions in several places
13031278
# this helps us import functions in a way that R CMD check won't cry about
13041279
ggfun <- function(x) {

R/layers2traces.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ layers2traces <- function(data, prestats_data, layout, p) {
8282
# 2. geom_smooth() is really geom_path() + geom_ribbon()
8383
datz <- list()
8484
paramz <- list()
85-
layout <- if (is_dev_ggplot2()) layout else list(layout = layout)
8685
for (i in seq_along(data)) {
8786
# This has to be done in a loop, since some layers are really two layers,
8887
# (and we need to replicate the data/params in those cases)

tests/testthat.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ test_run <- function(...) {
150150
test_check(...)
151151
}
152152

153-
if (packageVersion("ggplot2") > "2.2.1") {
154-
test_run("plotly")
155-
}
153+
test_run("plotly")
156154

157155
# now, actually build the table (if necessary)
158156
if (build_table) {

tests/testthat/test-ggplot-contour.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
context("Contour")
22

3-
volcano3d <- reshape2::melt(volcano)
4-
names(volcano3d) <- c("x", "y", "z")
5-
# Draw a contour plot using geom_contour
6-
gg <- ggplot(volcano3d) + geom_contour(aes(x=x, y=y, z=z))
7-
L <- save_outputs(gg, "contour")
3+
84

95
test_that("geom_contour is translated to a path", {
6+
skip_if_not_installed("reshape2")
7+
8+
volcano3d <- getFromNamespace("melt", "reshape2")(volcano)
9+
names(volcano3d) <- c("x", "y", "z")
10+
# Draw a contour plot using geom_contour
11+
gg <- ggplot(volcano3d) + geom_contour(aes(x=x, y=y, z=z))
12+
L <- save_outputs(gg, "contour")
1013
expect_equivalent(length(L$data), 1)
1114
expect_identical(L$data[[1]]$type, "scatter")
1215
expect_identical(L$data[[1]]$mode, "lines")

tests/testthat/test-ggplot-facets.R

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
context("Facets")
22

33
test_that("6 facets becomes 6 panels", {
4-
data(barley, package = "lattice")
4+
5+
# data(barley, package = "lattice")
6+
# dput(barley)
7+
barley <- structure(list(
8+
yield = c(27, 48.86667, 27.43334, 39.93333, 32.96667, 28.96667, 43.06666, 55.2, 28.76667, 38.13333, 29.13333, 29.66667, 35.13333, 47.33333, 25.76667, 40.46667, 29.66667, 25.7, 39.9, 50.23333, 26.13333, 41.33333, 23.03333, 26.3, 36.56666, 63.8333, 43.76667, 46.93333, 29.76667, 33.93333, 43.26667, 58.1, 28.7, 45.66667, 32.16667, 33.6, 36.6, 65.7667, 30.36667, 48.56666, 24.93334, 28.1, 32.76667, 48.56666, 29.86667, 41.6, 34.7, 32, 24.66667, 46.76667, 22.6, 44.1, 19.7, 33.06666, 39.3, 58.8, 29.46667, 49.86667, 34.46667, 31.6, 26.9, 33.46667, 34.36666, 32.96667, 22.13333, 22.56667, 36.8, 37.73333, 35.13333, 26.16667, 14.43333, 25.86667, 27.43334, 38.5, 35.03333, 20.63333, 16.63333, 22.23333, 26.8, 37.4, 38.83333, 32.06666, 32.23333, 22.46667, 29.06667, 49.2333, 46.63333, 41.83333, 20.63333, 30.6, 26.43334, 42.2, 43.53334, 34.33333, 19.46667, 22.7, 25.56667, 44.7, 47, 30.53333, 19.9, 22.5, 28.06667, 36.03333, 43.2, 25.23333, 26.76667, 31.36667, 30, 41.26667, 44.23333, 32.13333, 15.23333, 27.36667, 38, 58.16667, 47.16667, 35.9, 20.66667, 29.33333),
9+
variety = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 7L, 7L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 5L, 5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 2L, 2L, 2L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 4L, 4L, 9L, 9L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 3L, 3L, 7L, 7L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 5L, 5L, 5L, 5L, 5L, 10L, 10L, 10L, 10L, 10L, 10L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 2L, 2L, 2L, 6L, 6L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 4L, 4L, 9L, 9L, 9L, 9L, 9L, 9L),
10+
.Label = c("Svansota", "No. 462", "Manchuria", "No. 475", "Velvet", "Peatland", "Glabron", "No. 457", "Wisconsin No. 38", "Trebi"), class = "factor"),
11+
year = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("1932", "1931"), class = "factor"),
12+
site = structure(c(3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L, 3L, 6L, 4L, 5L, 1L, 2L), .Label = c("Grand Rapids", "Duluth", "University Farm", "Morris", "Crookston", "Waseca"), class = "factor")),
13+
row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120"),
14+
class = "data.frame"
15+
)
516
gg <- qplot(yield, variety, data = barley,
617
color = year, facets = site ~ ., pch = I(1))+
718
theme_bw() +

tests/testthat/test-ggplot-heatmap.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ workweek <- matrix(
77
nrow = 5, ncol = 3, byrow = TRUE,
88
dimnames = list(day = wdays, time = dtimes)
99
)
10-
ww <- reshape2::melt(workweek)
11-
ww$day <- factor(ww$day, wdays)
12-
ww$time <- factor(ww$time, dtimes)
13-
# Plot a heatmap using geom_tile
14-
hm <- ggplot(ww) + geom_tile(aes(x = day, y = time, fill = value))
1510

1611
test_that("geom_tile is translated to type=heatmap", {
12+
skip_if_not_installed("reshape2")
13+
14+
ww <- getFromNamespace("melt", "reshape2")(workweek)
15+
ww$day <- factor(ww$day, wdays)
16+
ww$time <- factor(ww$time, dtimes)
17+
# Plot a heatmap using geom_tile
18+
hm <- ggplot(ww) + geom_tile(aes(x = day, y = time, fill = value))
19+
1720
L <- save_outputs(hm, "heatmap")
1821
# one trace is for the colorbar
1922
expect_equivalent(length(L$data), 2)

0 commit comments

Comments
 (0)