plot_geo returning a blank map in R

2019-09-11 11:36发布

I was trying to create a Plotly map in R using plot_geo. I wasn't getting any errors, but the Viewer was returning a blank map. The Plotly mode bar was showing up, but everything else was blank.

I couldn't even get the code below from the plot_geo help page to work:

library(plotly)
library(dplyr)

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

Has anyone else ran into this problem? I haven't had any trouble with plotly in R in the past.

标签: r maps plotly
1条回答
你好瞎i
2楼-- · 2019-09-11 12:19

I used your code but I had to load the following packages first:

library(dplyr)
library(ggplot2)
library(plotly)

The map generates correctly on my device, i.e. the borders of Canada are highlighted. The remaining countries don't have borders: enter image description here

I'm using the plotly version 4.5.6.9000.

If you are still running into your problems, try updating packages used. Restarting your R session could also help.

查看更多
登录 后发表回答