plot_geo返回R中的空白地图 [英] plot_geo returning a blank map in R

查看:248
本文介绍了plot_geo返回R中的空白地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用plot_geo在R中创建一个Plotly地图.我没有收到任何错误,但查看器返回的是空白地图.显示出Plotly模式栏,但其他所有内容均为空白.

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.

我什至无法从plot_geo帮助页面获得以下代码:

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))

还有其他人遇到过这个问题吗?过去,我对使用R中的plotly没有任何麻烦.

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

推荐答案

我使用了您的代码,但必须首先加载以下软件包:

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:

我正在使用版本4.5.6.9000.

I'm using the plotly version 4.5.6.9000.

如果仍然遇到问题,请尝试更新所使用的软件包.重新启动R会话也可能会有所帮助.

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

这篇关于plot_geo返回R中的空白地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆