Plotly: plot_geo returns a blank visualization in RStudio Viewer

Created on 1 Sep 2017  路  9Comments  路  Source: ropensci/plotly

I just can't get plot_geo to display correctly in RStudio Viewer.
This is weird because I can use other plotly commands, including ggplotly, to create interactive plots. I am running R version 3.3.3 and RStudio version 1.1.350 with plotly version 4.7.1. Initially, I call on 3 packages by recommendation I saw here: plot-geo-returning-a-blank-map-in-r

library(dplyr)
library(ggplot2)
library(plotly)
map_data("world", "canada") %>%
  group_by(group) %>%
  plot_geo(x = ~long, y = ~lat) %>%
  add_markers(size = I(1))

image

I get an empty plot, but if I hover over it, I can see the latitude and longitude information.
Would anyone know how to debug this problem? I've tried to reinstall ggplot2 and plotly from both CRAN and GItHub and different versions of R and RStudio without much luck.

I can see the plot if I select "Show in new window" and generate the plot in Chrome.

Most helpful comment

I know this issue is closed and I don't mean to re-open it, but for the benefit of people like me who are googling this issue: a workaround is to click the "Show in new window" button in the RStudio Viewer toolbar (the button right next to the Clear broom icon). This will launch a browser window (e.g. Chrome) where the visualization will properly load.

All 9 comments

Likely a duplicate of #356

My laptop is always connected to the Internet / has Wi-Fi connection; I can download data from the same RStudio session. My colleague was able to generate the same chart in RStudio Viewer using the same version of plotly, so I couldn't detect the exact issue.

Whoops, sorry, could you please right-click on the graph in RStudio, then choose "Inspect Element", then click on the Console tab and report any errors you see?

image
Would this be an error only on my end? Not sure if this is related, but I'm able to use ggmaps without a problem.

No, it's an RStudio issue that unfortunately I can't do much about. It should render fine in any other web browser though

Is there a version of RStudio in which this would work? I'm not entirely sure why it works for my colleague if it's RStudio issue.

I know this issue is closed and I don't mean to re-open it, but for the benefit of people like me who are googling this issue: a workaround is to click the "Show in new window" button in the RStudio Viewer toolbar (the button right next to the Clear broom icon). This will launch a browser window (e.g. Chrome) where the visualization will properly load.

I ran into the same issues today (November 2019). The "show in new window" workaround did not work. In the end, I

  • (re-)opened the "blank" map in the RStudio Viewer pane with the command print(p) [p being the object I stored the plot in]
  • via the Export dropdown >> save a web page
  • opening that file you can inspect your map (as it is html, you can also embed it in other html pages)

In my case, the issue was solved changing the rendering engine to auto-detect.
On RStudio, go to Tools -> Global Options ->General -> Advance and then under OS Integration, click onRendering engine to. Auto-detect (recommended)

Was this page helpful?
0 / 5 - 0 ratings