Skip to content

Commit

Permalink
Fix rstudio windows warning (#2300)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Oller <Sergio.OllerMoreno@almirall.com>
  • Loading branch information
zeehio and zeehio committed Oct 5, 2023
1 parent 50c50ea commit a1c3089
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions R/plotly_build.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit a1c3089

Please sign in to comment.