diff --git a/DESCRIPTION b/DESCRIPTION index 6e1ab9297a..c6c345a384 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: plotly Title: Create Interactive Web Graphics via 'plotly.js' -Version: 4.9.4 +Version: 4.9.4.9000 Authors@R: c(person("Carson", "Sievert", role = c("aut", "cre"), email = "cpsievert1@gmail.com", comment = c(ORCID = "0000-0002-4958-2844")), person("Chris", "Parmer", role = "aut", diff --git a/NEWS.md b/NEWS.md index 0b73e3a21f..5fdba8a80a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,16 @@ +# 4.9.4.9000 + +## BUG FIXES + +* Fixes a bug in `ggplotly()` with `{crosstalk}` and `{ggplot2}` v3.3.4 (#1952). + # 4.9.4 ## BUG FIXES * Duplicate `highlight(selectize=T)` dropdowns are no longer rendered in Shiny (#1936). * `group_by.plotly()` now properly retains crosstalk information across `{dplyr}` versions (#1920). -* Adds fixes in `ggplotly()` for the upcoming `{ggplot2}` >3.3.3 release (#1952). +* Adds fixes in `ggplotly()` for the upcoming `{ggplot2}` v3.3.4 release (#1952). * Fixes some issues with `name` and `frames` when both attributes are specified. (#1903 and #1618). # 4.9.3 diff --git a/R/ggplotly.R b/R/ggplotly.R index 19a0850809..93ac3b9e49 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -264,7 +264,12 @@ gg2list <- function(p, width = NULL, height = NULL, layers <- Map(function(x, y) { if (crosstalk_key() %in% names(y) && !"key" %in% names(x[["mapping"]]) && inherits(x[["stat"]], "StatIdentity")) { - x[["mapping"]] <- c(x[["mapping"]], key = as.name(crosstalk_key())) + # ggplot2 v3.3.4 started using the computed_mapping (instead of mapping) + # field to inform the compute_aesthetics() method, so in order to add + # the crosstalk key, we need to add to that field (when present) + # https://github.com/tidyverse/ggplot2/pull/4475 + nm <- if ("computed_mapping" %in% names(x)) "computed_mapping" else "mapping" + x[[nm]] <- c(x[[nm]], key = as.name(crosstalk_key())) } x }, layers, layer_data)