Skip to content

plot_geo returns a blank visualization in RStudio Viewer #1111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dfrail24 opened this issue Sep 1, 2017 · 9 comments
Closed

plot_geo returns a blank visualization in RStudio Viewer #1111

dfrail24 opened this issue Sep 1, 2017 · 9 comments

Comments

@dfrail24
Copy link

dfrail24 commented Sep 1, 2017

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.

@cpsievert
Copy link
Collaborator

Likely a duplicate of #356

@dfrail24
Copy link
Author

dfrail24 commented Sep 1, 2017

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.

@cpsievert
Copy link
Collaborator

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?

@cpsievert cpsievert reopened this Sep 1, 2017
@dfrail24
Copy link
Author

dfrail24 commented Sep 1, 2017

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.

@cpsievert
Copy link
Collaborator

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

@dfrail24
Copy link
Author

dfrail24 commented Sep 1, 2017

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.

@otravers
Copy link

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.

@rainer-rq-koelle
Copy link

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)

@c1au6i0
Copy link

c1au6i0 commented May 1, 2020

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants