diff --git a/NEWS.md b/NEWS.md
index 674fb5a159..882d900d4d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
# 4.10.2.9000
+## Improvements
+
+* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.3). (#2301)
+
## Bug fixes
* Closed #1947: `ggplotly()` now correctly handles `geom_vline`/`geom_hline` with empty data. Previously, if `geom_vline`/`geom_hline` was passed an empty data frame, it would result in an error. The plot is drawn even if no lines are found; this is the same behavior as `ggplot2`.
diff --git a/R/ggplotly.R b/R/ggplotly.R
index 8ac3cd7ed8..e6805169a2 100644
--- a/R/ggplotly.R
+++ b/R/ggplotly.R
@@ -725,11 +725,11 @@ gg2list <- function(p, width = NULL, height = NULL,
call. = FALSE
)
}
- # determine axis types (note: scale_name may go away someday)
- # https://github.com/hadley/ggplot2/issues/1312
- isDate <- isTRUE(sc$scale_name %in% c("date", "datetime"))
+
+ # determine axis types
+ isDate <- inherits(sc, c("ScaleContinuousDatetime", "ScaleContinuousDate"))
isDateType <- isDynamic && isDate
- isDiscrete <- identical(sc$scale_name, "position_d")
+ isDiscrete <- inherits(sc, "ScaleDiscretePosition")
isDiscreteType <- isDynamic && isDiscrete
# In 3.2.x .major disappeared in favor of break_positions()
@@ -1512,7 +1512,14 @@ scales_add_missing <- function(plot, aesthetics) {
# towards ggproto methods attached to `plot$guides`
# -------------------------------------------------------------------------
get_gdefs_ggproto <- function(scales, theme, plot, layers) {
- guides <- plot$guides$setup(scales)
+
+ # Unfortunate duplication of logic in tidyverse/ggplot2#5428
+ # which ensures a 1:1 mapping between aesthetics and scales
+ aesthetics <- lapply(scales, `[[`, "aesthetics")
+ scales <- rep.int(scales, lengths(aesthetics))
+ aesthetics <- unlist(aesthetics, recursive = FALSE, use.names = FALSE)
+
+ guides <- plot$guides$setup(scales, aesthetics = aesthetics)
guides$train(scales, theme$legend.direction, plot$labels)
if (length(guides$guides) > 0) {
guides$merge()
diff --git a/R/layers2traces.R b/R/layers2traces.R
index 77244a6e54..240087563f 100644
--- a/R/layers2traces.R
+++ b/R/layers2traces.R
@@ -79,7 +79,8 @@ layers2traces <- function(data, prestats_data, layout, p) {
discreteScales <- list()
for (sc in p$scales$non_position_scales()$scales) {
if (sc$is_discrete()) {
- discreteScales[[sc$aesthetics]] <- sc
+ nm <- paste(sc$aesthetics, collapse = "_")
+ discreteScales[[nm]] <- sc
}
}
# Convert "high-level" geoms to their "low-level" counterpart
diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json
index 175aa7b1a3..0a80458075 100644
--- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json
+++ b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/001.json
@@ -14,70 +14,70 @@
"x": [
21,
21,
- 22.8,
- 21.4,
- 18.7,
- 18.1,
- 14.3,
- 24.4,
- 22.8,
- 19.2,
- 17.8,
- 16.4,
- 17.3,
- 15.2,
+ 22.800000000000001,
+ 21.399999999999999,
+ 18.699999999999999,
+ 18.100000000000001,
+ 14.300000000000001,
+ 24.399999999999999,
+ 22.800000000000001,
+ 19.199999999999999,
+ 17.800000000000001,
+ 16.399999999999999,
+ 17.300000000000001,
+ 15.199999999999999,
10.4,
10.4,
- 14.7,
- 32.4,
- 30.4,
- 33.9,
+ 14.699999999999999,
+ 32.399999999999999,
+ 30.399999999999999,
+ 33.899999999999999,
21.5,
15.5,
- 15.2,
- 13.3,
- 19.2,
- 27.3,
+ 15.199999999999999,
+ 13.300000000000001,
+ 19.199999999999999,
+ 27.300000000000001,
26,
- 30.4,
- 15.8,
- 19.7,
+ 30.399999999999999,
+ 15.800000000000001,
+ 19.699999999999999,
15,
- 21.4
+ 21.399999999999999
],
"y": [
- 2.62,
+ 2.6200000000000001,
2.875,
- 2.32,
- 3.215,
- 3.44,
+ 2.3199999999999998,
+ 3.2149999999999999,
+ 3.4399999999999999,
3.46,
- 3.57,
- 3.19,
- 3.15,
- 3.44,
- 3.44,
- 4.07,
+ 3.5699999999999998,
+ 3.1899999999999999,
+ 3.1499999999999999,
+ 3.4399999999999999,
+ 3.4399999999999999,
+ 4.0700000000000003,
3.73,
- 3.78,
+ 3.7799999999999998,
5.25,
- 5.424,
- 5.345,
- 2.2,
+ 5.4240000000000004,
+ 5.3449999999999998,
+ 2.2000000000000002,
1.615,
1.835,
- 2.465,
+ 2.4649999999999999,
3.52,
- 3.435,
- 3.84,
- 3.845,
- 1.935,
- 2.14,
- 1.513,
- 3.17,
+ 3.4350000000000001,
+ 3.8399999999999999,
+ 3.8450000000000002,
+ 1.9350000000000001,
+ 2.1400000000000001,
+ 1.5129999999999999,
+ 3.1699999999999999,
2.77,
- 3.57,
- 2.78
+ 3.5699999999999998,
+ 2.7799999999999998
],
"text": [
"mpg: 21.0
wt: 2.620
nms: Mazda RX4",
@@ -153,10 +153,10 @@
"autocolorscale": false,
"color": "rgba(0,0,0,1)",
"opacity": 1,
- "size": 5.66929133858268,
+ "size": 5.6692913385826778,
"symbol": "circle",
"line": {
- "width": 1.88976377952756,
+ "width": 1.8897637795275593,
"color": "rgba(0,0,0,1)"
}
},
@@ -170,17 +170,17 @@
],
"layout": {
"margin": {
- "t": 25.7412480974125,
- "r": 7.30593607305936,
- "b": 39.6955859969559,
- "l": 31.4155251141553
+ "t": 25.74124809741248,
+ "r": 7.3059360730593621,
+ "b": 39.69558599695587,
+ "l": 31.415525114155255
},
"plot_bgcolor": "rgba(235,235,235,1)",
"paper_bgcolor": "rgba(255,255,255,1)",
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
},
"xaxis": {
"domain": [
@@ -191,8 +191,8 @@
"type": "linear",
"autorange": false,
"range": [
- 9.225,
- 35.075
+ 9.2249999999999996,
+ 35.074999999999996
],
"tickmode": "array",
"ticktext": [
@@ -223,13 +223,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -237,7 +237,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "y",
"title": {
@@ -245,7 +245,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -259,8 +259,8 @@
"type": "linear",
"autorange": false,
"range": [
- 1.31745,
- 5.61955
+ 1.3174499999999998,
+ 5.6195500000000003
],
"tickmode": "array",
"ticktext": [
@@ -285,13 +285,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -299,7 +299,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "x",
"title": {
@@ -307,7 +307,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -335,11 +335,11 @@
"legend": {
"bgcolor": "rgba(255,255,255,1)",
"bordercolor": "transparent",
- "borderwidth": 1.88976377952756,
+ "borderwidth": 1.8897637795275593,
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
}
},
"hovermode": "closest",
@@ -374,7 +374,7 @@
"persistent": false,
"dynamic": false,
"selectize": false,
- "opacityDim": 0.2,
+ "opacityDim": 0.20000000000000001,
"selected": {
"opacity": 1
},
diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json
index 5025798b36..52807af51f 100644
--- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json
+++ b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/002.json
@@ -32,70 +32,70 @@
"x": [
21,
21,
- 22.8,
- 21.4,
- 18.7,
- 18.1,
- 14.3,
- 24.4,
- 22.8,
- 19.2,
- 17.8,
- 16.4,
- 17.3,
- 15.2,
+ 22.800000000000001,
+ 21.399999999999999,
+ 18.699999999999999,
+ 18.100000000000001,
+ 14.300000000000001,
+ 24.399999999999999,
+ 22.800000000000001,
+ 19.199999999999999,
+ 17.800000000000001,
+ 16.399999999999999,
+ 17.300000000000001,
+ 15.199999999999999,
10.4,
10.4,
- 14.7,
- 32.4,
- 30.4,
- 33.9,
+ 14.699999999999999,
+ 32.399999999999999,
+ 30.399999999999999,
+ 33.899999999999999,
21.5,
15.5,
- 15.2,
- 13.3,
- 19.2,
- 27.3,
+ 15.199999999999999,
+ 13.300000000000001,
+ 19.199999999999999,
+ 27.300000000000001,
26,
- 30.4,
- 15.8,
- 19.7,
+ 30.399999999999999,
+ 15.800000000000001,
+ 19.699999999999999,
15,
- 21.4
+ 21.399999999999999
],
"y": [
- 2.62,
+ 2.6200000000000001,
2.875,
- 2.32,
- 3.215,
- 3.44,
+ 2.3199999999999998,
+ 3.2149999999999999,
+ 3.4399999999999999,
3.46,
- 3.57,
- 3.19,
- 3.15,
- 3.44,
- 3.44,
- 4.07,
+ 3.5699999999999998,
+ 3.1899999999999999,
+ 3.1499999999999999,
+ 3.4399999999999999,
+ 3.4399999999999999,
+ 4.0700000000000003,
3.73,
- 3.78,
+ 3.7799999999999998,
5.25,
- 5.424,
- 5.345,
- 2.2,
+ 5.4240000000000004,
+ 5.3449999999999998,
+ 2.2000000000000002,
1.615,
1.835,
- 2.465,
+ 2.4649999999999999,
3.52,
- 3.435,
- 3.84,
- 3.845,
- 1.935,
- 2.14,
- 1.513,
- 3.17,
+ 3.4350000000000001,
+ 3.8399999999999999,
+ 3.8450000000000002,
+ 1.9350000000000001,
+ 2.1400000000000001,
+ 1.5129999999999999,
+ 3.1699999999999999,
2.77,
- 3.57,
- 2.78
+ 3.5699999999999998,
+ 2.7799999999999998
],
"text": [
"mpg: 21.0
wt: 2.620
nms: Mazda RX4",
@@ -171,10 +171,10 @@
"autocolorscale": false,
"color": "rgba(0,0,0,1)",
"opacity": 1,
- "size": 5.66929133858268,
+ "size": 5.6692913385826778,
"symbol": "circle",
"line": {
- "width": 1.88976377952756,
+ "width": 1.8897637795275593,
"color": "rgba(0,0,0,1)"
}
},
@@ -188,17 +188,17 @@
],
"layout": {
"margin": {
- "t": 25.7412480974125,
- "r": 7.30593607305936,
- "b": 39.6955859969559,
- "l": 31.4155251141553
+ "t": 25.74124809741248,
+ "r": 7.3059360730593621,
+ "b": 39.69558599695587,
+ "l": 31.415525114155255
},
"plot_bgcolor": "rgba(235,235,235,1)",
"paper_bgcolor": "rgba(255,255,255,1)",
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
},
"xaxis": {
"domain": [
@@ -209,8 +209,8 @@
"type": "linear",
"autorange": false,
"range": [
- 9.225,
- 35.075
+ 9.2249999999999996,
+ 35.074999999999996
],
"tickmode": "array",
"ticktext": [
@@ -241,13 +241,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -255,7 +255,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "y",
"title": {
@@ -263,7 +263,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -277,8 +277,8 @@
"type": "linear",
"autorange": false,
"range": [
- 1.31745,
- 5.61955
+ 1.3174499999999998,
+ 5.6195500000000003
],
"tickmode": "array",
"ticktext": [
@@ -303,13 +303,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -317,7 +317,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "x",
"title": {
@@ -325,7 +325,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -353,11 +353,11 @@
"legend": {
"bgcolor": "rgba(255,255,255,1)",
"bordercolor": "transparent",
- "borderwidth": 1.88976377952756,
+ "borderwidth": 1.8897637795275593,
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
}
},
"hovermode": "closest",
@@ -392,7 +392,7 @@
"persistent": false,
"dynamic": false,
"selectize": false,
- "opacityDim": 0.2,
+ "opacityDim": 0.20000000000000001,
"selected": {
"opacity": 1
},
diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json
index 17a3bbfe4b..069ced6f20 100644
--- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json
+++ b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/003.json
@@ -36,70 +36,70 @@
"x": [
21,
21,
- 22.8,
- 21.4,
- 18.7,
- 18.1,
- 14.3,
- 24.4,
- 22.8,
- 19.2,
- 17.8,
- 16.4,
- 17.3,
- 15.2,
+ 22.800000000000001,
+ 21.399999999999999,
+ 18.699999999999999,
+ 18.100000000000001,
+ 14.300000000000001,
+ 24.399999999999999,
+ 22.800000000000001,
+ 19.199999999999999,
+ 17.800000000000001,
+ 16.399999999999999,
+ 17.300000000000001,
+ 15.199999999999999,
10.4,
10.4,
- 14.7,
- 32.4,
- 30.4,
- 33.9,
+ 14.699999999999999,
+ 32.399999999999999,
+ 30.399999999999999,
+ 33.899999999999999,
21.5,
15.5,
- 15.2,
- 13.3,
- 19.2,
- 27.3,
+ 15.199999999999999,
+ 13.300000000000001,
+ 19.199999999999999,
+ 27.300000000000001,
26,
- 30.4,
- 15.8,
- 19.7,
+ 30.399999999999999,
+ 15.800000000000001,
+ 19.699999999999999,
15,
- 21.4
+ 21.399999999999999
],
"y": [
- 2.62,
+ 2.6200000000000001,
2.875,
- 2.32,
- 3.215,
- 3.44,
+ 2.3199999999999998,
+ 3.2149999999999999,
+ 3.4399999999999999,
3.46,
- 3.57,
- 3.19,
- 3.15,
- 3.44,
- 3.44,
- 4.07,
+ 3.5699999999999998,
+ 3.1899999999999999,
+ 3.1499999999999999,
+ 3.4399999999999999,
+ 3.4399999999999999,
+ 4.0700000000000003,
3.73,
- 3.78,
+ 3.7799999999999998,
5.25,
- 5.424,
- 5.345,
- 2.2,
+ 5.4240000000000004,
+ 5.3449999999999998,
+ 2.2000000000000002,
1.615,
1.835,
- 2.465,
+ 2.4649999999999999,
3.52,
- 3.435,
- 3.84,
- 3.845,
- 1.935,
- 2.14,
- 1.513,
- 3.17,
+ 3.4350000000000001,
+ 3.8399999999999999,
+ 3.8450000000000002,
+ 1.9350000000000001,
+ 2.1400000000000001,
+ 1.5129999999999999,
+ 3.1699999999999999,
2.77,
- 3.57,
- 2.78
+ 3.5699999999999998,
+ 2.7799999999999998
],
"text": [
"mpg: 21.0
wt: 2.620
nms: Mazda RX4",
@@ -175,10 +175,10 @@
"autocolorscale": false,
"color": "rgba(0,0,0,1)",
"opacity": 1,
- "size": 5.66929133858268,
+ "size": 5.6692913385826778,
"symbol": "circle",
"line": {
- "width": 1.88976377952756,
+ "width": 1.8897637795275593,
"color": "rgba(0,0,0,1)"
}
},
@@ -192,17 +192,17 @@
],
"layout": {
"margin": {
- "t": 25.7412480974125,
- "r": 7.30593607305936,
- "b": 39.6955859969559,
- "l": 31.4155251141553
+ "t": 25.74124809741248,
+ "r": 7.3059360730593621,
+ "b": 39.69558599695587,
+ "l": 31.415525114155255
},
"plot_bgcolor": "rgba(235,235,235,1)",
"paper_bgcolor": "rgba(255,255,255,1)",
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
},
"xaxis": {
"domain": [
@@ -213,8 +213,8 @@
"type": "linear",
"autorange": false,
"range": [
- 9.225,
- 35.075
+ 9.2249999999999996,
+ 35.074999999999996
],
"tickmode": "array",
"ticktext": [
@@ -245,13 +245,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -259,7 +259,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "y",
"title": {
@@ -267,7 +267,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -281,8 +281,8 @@
"type": "linear",
"autorange": false,
"range": [
- 1.31745,
- 5.61955
+ 1.3174499999999998,
+ 5.6195500000000003
],
"tickmode": "array",
"ticktext": [
@@ -307,13 +307,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -321,7 +321,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "x",
"title": {
@@ -329,7 +329,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -357,11 +357,11 @@
"legend": {
"bgcolor": "rgba(255,255,255,1)",
"bordercolor": "transparent",
- "borderwidth": 1.88976377952756,
+ "borderwidth": 1.8897637795275593,
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
}
},
"hovermode": "closest",
@@ -396,7 +396,7 @@
"persistent": false,
"dynamic": false,
"selectize": false,
- "opacityDim": 0.2,
+ "opacityDim": 0.20000000000000001,
"selected": {
"opacity": 1
},
diff --git a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json
index 2fce4cb389..2b72add64b 100644
--- a/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json
+++ b/inst/examples/shiny/event_data/tests/shinytest/mytest-expected/004.json
@@ -37,70 +37,70 @@
"x": [
21,
21,
- 22.8,
- 21.4,
- 18.7,
- 18.1,
- 14.3,
- 24.4,
- 22.8,
- 19.2,
- 17.8,
- 16.4,
- 17.3,
- 15.2,
+ 22.800000000000001,
+ 21.399999999999999,
+ 18.699999999999999,
+ 18.100000000000001,
+ 14.300000000000001,
+ 24.399999999999999,
+ 22.800000000000001,
+ 19.199999999999999,
+ 17.800000000000001,
+ 16.399999999999999,
+ 17.300000000000001,
+ 15.199999999999999,
10.4,
10.4,
- 14.7,
- 32.4,
- 30.4,
- 33.9,
+ 14.699999999999999,
+ 32.399999999999999,
+ 30.399999999999999,
+ 33.899999999999999,
21.5,
15.5,
- 15.2,
- 13.3,
- 19.2,
- 27.3,
+ 15.199999999999999,
+ 13.300000000000001,
+ 19.199999999999999,
+ 27.300000000000001,
26,
- 30.4,
- 15.8,
- 19.7,
+ 30.399999999999999,
+ 15.800000000000001,
+ 19.699999999999999,
15,
- 21.4
+ 21.399999999999999
],
"y": [
- 2.62,
+ 2.6200000000000001,
2.875,
- 2.32,
- 3.215,
- 3.44,
+ 2.3199999999999998,
+ 3.2149999999999999,
+ 3.4399999999999999,
3.46,
- 3.57,
- 3.19,
- 3.15,
- 3.44,
- 3.44,
- 4.07,
+ 3.5699999999999998,
+ 3.1899999999999999,
+ 3.1499999999999999,
+ 3.4399999999999999,
+ 3.4399999999999999,
+ 4.0700000000000003,
3.73,
- 3.78,
+ 3.7799999999999998,
5.25,
- 5.424,
- 5.345,
- 2.2,
+ 5.4240000000000004,
+ 5.3449999999999998,
+ 2.2000000000000002,
1.615,
1.835,
- 2.465,
+ 2.4649999999999999,
3.52,
- 3.435,
- 3.84,
- 3.845,
- 1.935,
- 2.14,
- 1.513,
- 3.17,
+ 3.4350000000000001,
+ 3.8399999999999999,
+ 3.8450000000000002,
+ 1.9350000000000001,
+ 2.1400000000000001,
+ 1.5129999999999999,
+ 3.1699999999999999,
2.77,
- 3.57,
- 2.78
+ 3.5699999999999998,
+ 2.7799999999999998
],
"text": [
"mpg: 21.0
wt: 2.620
nms: Mazda RX4",
@@ -176,10 +176,10 @@
"autocolorscale": false,
"color": "rgba(0,0,0,1)",
"opacity": 1,
- "size": 5.66929133858268,
+ "size": 5.6692913385826778,
"symbol": "circle",
"line": {
- "width": 1.88976377952756,
+ "width": 1.8897637795275593,
"color": "rgba(0,0,0,1)"
}
},
@@ -193,17 +193,17 @@
],
"layout": {
"margin": {
- "t": 25.7412480974125,
- "r": 7.30593607305936,
- "b": 39.6955859969559,
- "l": 31.4155251141553
+ "t": 25.74124809741248,
+ "r": 7.3059360730593621,
+ "b": 39.69558599695587,
+ "l": 31.415525114155255
},
"plot_bgcolor": "rgba(235,235,235,1)",
"paper_bgcolor": "rgba(255,255,255,1)",
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
},
"xaxis": {
"domain": [
@@ -214,8 +214,8 @@
"type": "linear",
"autorange": false,
"range": [
- 9.225,
- 35.075
+ 9.2249999999999996,
+ 35.074999999999996
],
"tickmode": "array",
"ticktext": [
@@ -246,13 +246,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -260,7 +260,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "y",
"title": {
@@ -268,7 +268,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -282,8 +282,8 @@
"type": "linear",
"autorange": false,
"range": [
- 1.31745,
- 5.61955
+ 1.3174499999999998,
+ 5.6195500000000003
],
"tickmode": "array",
"ticktext": [
@@ -308,13 +308,13 @@
"nticks": null,
"ticks": "outside",
"tickcolor": "rgba(51,51,51,1)",
- "ticklen": 3.65296803652968,
- "tickwidth": 0.66417600664176,
+ "ticklen": 3.6529680365296811,
+ "tickwidth": 0.66417600664176002,
"showticklabels": true,
"tickfont": {
"color": "rgba(77,77,77,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
},
"tickangle": 0,
"showline": false,
@@ -322,7 +322,7 @@
"linewidth": 0,
"showgrid": true,
"gridcolor": "rgba(255,255,255,1)",
- "gridwidth": 0.66417600664176,
+ "gridwidth": 0.66417600664176002,
"zeroline": false,
"anchor": "x",
"title": {
@@ -330,7 +330,7 @@
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 14.6118721461187
+ "size": 14.611872146118724
}
},
"hoverformat": ".2f"
@@ -358,11 +358,11 @@
"legend": {
"bgcolor": "rgba(255,255,255,1)",
"bordercolor": "transparent",
- "borderwidth": 1.88976377952756,
+ "borderwidth": 1.8897637795275593,
"font": {
"color": "rgba(0,0,0,1)",
"family": "",
- "size": 11.689497716895
+ "size": 11.68949771689498
}
},
"hovermode": "closest",
@@ -397,7 +397,7 @@
"persistent": false,
"dynamic": false,
"selectize": false,
- "opacityDim": 0.2,
+ "opacityDim": 0.20000000000000001,
"selected": {
"opacity": 1
},
diff --git a/tests/testthat/_snaps/ggplot-area/area-traces-order.svg b/tests/testthat/_snaps/ggplot-area/area-traces-order.svg
index 48426b9a11..d1e4cbe457 100644
--- a/tests/testthat/_snaps/ggplot-area/area-traces-order.svg
+++ b/tests/testthat/_snaps/ggplot-area/area-traces-order.svg
@@ -1 +1 @@
-
+
diff --git a/tests/testthat/_snaps/ggplot-labels/factor-labels.svg b/tests/testthat/_snaps/ggplot-labels/factor-labels.svg
index eecef86a59..53f11d16c8 100644
--- a/tests/testthat/_snaps/ggplot-labels/factor-labels.svg
+++ b/tests/testthat/_snaps/ggplot-labels/factor-labels.svg
@@ -1 +1 @@
-
+
diff --git a/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg b/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg
new file mode 100644
index 0000000000..6654130403
--- /dev/null
+++ b/tests/testthat/_snaps/ggplot-legend/legend-varying-aes-guide.svg
@@ -0,0 +1 @@
+
diff --git a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg
index 9d2ffb8e85..f3142fa13b 100644
--- a/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg
+++ b/tests/testthat/_snaps/plotly-subplot/plotly-subplot-plot-list.svg
@@ -1 +1 @@
-
+
diff --git a/tests/testthat/test-ggplot-legend.R b/tests/testthat/test-ggplot-legend.R
index d4dfe4eed2..9dd92ea96c 100644
--- a/tests/testthat/test-ggplot-legend.R
+++ b/tests/testthat/test-ggplot-legend.R
@@ -148,3 +148,17 @@ test_that("many legend items", {
p <- ggplot(midwest, aes(category, fill = category)) + geom_bar()
info <- expect_traces(p, length(unique(midwest$category)), "many legend items")
})
+
+
+# Make sure we can support the bugfix made in tidyverse/ggplot2#5425
+test_that("can handle varying aesthetics/scales", {
+ df <- data.frame(x = (1:3)/3, z = c("red", "blue", "green"))
+
+ p <- ggplot(df) +
+ aes(x, z, colour = z, fill = z, size = x) +
+ geom_point() +
+ scale_discrete_identity(aesthetics = c("colour", "fill")) +
+ scale_size_identity()
+
+ expect_traces(p, 1, "varying-aes-guide")
+})
diff --git a/tests/testthat/test-ggplot-lines.R b/tests/testthat/test-ggplot-lines.R
index 055f6711ee..e70179612a 100644
--- a/tests/testthat/test-ggplot-lines.R
+++ b/tests/testthat/test-ggplot-lines.R
@@ -50,7 +50,7 @@ test_that("Milliseconds are preserved with dynamic ticks", {
p <- ggplotly(gg, dynamicTicks = TRUE)
j <- plotly_json(p, jsonedit = FALSE)
t2 <- jsonlite::fromJSON(j)$data$x[[1]] %>%
- as.POSIXct(format = "%Y-%m-%d %H:%M:%OS")
+ as.POSIXct(format = "%Y-%m-%d %H:%M:%OS", origin = "1970-01-01 00:00:00")
expect_equal(as.numeric(mean(diff(t2))), 0.1, tolerance = 0.01)
expect_doppelganger_built(p, "line-milliseconds")
})