From a1c3089e7439d84e199fb75adfeca2acd1284cc5 Mon Sep 17 00:00:00 2001 From: Sergio Oller Date: Thu, 5 Oct 2023 21:50:16 +0200 Subject: [PATCH] Fix rstudio windows warning (#2300) Co-authored-by: Sergio Oller --- NEWS.md | 2 ++ R/plotly_build.R | 6 +----- R/utils.R | 16 ---------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/NEWS.md b/NEWS.md index 91e0074afd..2b9f86c9e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ * 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`. +* Closed #1214: Do not warn in RStudio on Windows when scattergl is used. Recent RStudio versions can render scattergl correctly. + # 4.10.2 ## New features diff --git a/R/plotly_build.R b/R/plotly_build.R index 523f25bd7a..ad9f62c704 100644 --- a/R/plotly_build.R +++ b/R/plotly_build.R @@ -395,11 +395,7 @@ plotly_build.plotly <- function(p, registerFrames = TRUE) { # if a partial bundle was specified, make sure it supports the visualization p <- verify_partial_bundle(p) - - # scattergl currently doesn't render in RStudio on Windows - # https://github.com/ropensci/plotly/issues/1214 - p <- verify_scattergl_platform(p) - + # make sure plots don't get sent out of the network (for enterprise) p$x$base_url <- get_domain() p diff --git a/R/utils.R b/R/utils.R index 29f3c5ec5e..da79d43cf2 100644 --- a/R/utils.R +++ b/R/utils.R @@ -948,22 +948,6 @@ verify_mathjax <- function(p) { p } -verify_scattergl_platform <- function(p) { - if (!identical(.Platform$OS.type, "windows")) return(p) - if (!is_rstudio()) return(p) - - types <- vapply(p$x$data, function(x) x[["type"]] %||% "scatter", character(1)) - if ("scattergl" %in% types) { - warning( - "'scattergl' trace types don't currently render in RStudio on Windows. ", - "Open in another web browser (IE, Chrome, Firefox, etc).", - call. = FALSE - ) - } - - p -} - has_marker <- function(types, modes) { is_scatter <- grepl("scatter", types) ifelse(is_scatter, grepl("marker", modes), has_attr(types, "marker"))