plot_geo returning a blank map in R

為{幸葍}努か 提交于 2019-12-12 03:53:22

问题


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.


回答1:


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:

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.



来源:https://stackoverflow.com/questions/41103848/plot-geo-returning-a-blank-map-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!