R中的Mapdeck程序包-add_grid似乎不呈现任何内容 [英] Mapdeck Package in R - add_grid Does Not Appear to Render Anything
问题描述
问题:
R mapdeck
包中的add_grid
函数非常令人兴奋.但是,按照 CRAN文档,我似乎无法获得实际在返回的地图上绘制的任何数据.
The add_grid
function in the R mapdeck
package is very exciting. However, following the CRAN documentation, I cannot seem to get any data to actually plot on the returned map.
换句话说,地图返回了,但是没有绘制数据.这是一个已知的错误吗?
In other words, the map returns, but no data is plotted. Is this a known bug?
代码:
library(tidyverse)
library(mapdeck)
# - Enter mapdeck key ... Note that it is user-specific
key <- rstudioapi::askForPassword()
# - Read Example Data Set
df <- read.csv(paste0(
'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/',
'examples/3d-heatmap/heatmap-data.csv'
))
# - Plot Data ... Note how the map returns, but not the data
mapdeck( token = key, style = 'mapbox://styles/mapbox/dark-v9', pitch = 45 ) %>%
add_grid(
data = df
, lat = "lat"
, lon = "lng"
, cell_size = 5000
, elevation_scale = 50
, layer_id = "grid_layer"
)
由 reprex软件包(v0.2.1)于2018-09-23创建
输出:
推荐答案
这不一定是mapdeck
本身内部的错误",而是mapdeck
与RStudio
进行通信的方式.他们使用的不同javascript版本之间存在冲突.
This is not necessarily a 'bug' inside mapdeck
itself, but more the way mapdeck
communicates with RStudio
. There are conflicts between the different javascript versions they use.
如果您在浏览器中打开该图(通过按Rstudio中的在新窗口中显示按钮),则应该获取该图.
If you open the plot in a browser (by pressing the show in new window button in Rstudio) you should get your plot.
我遇到了这个问题已记录,但不知道方法前进呢.
I've got this issue logged, but don't know the way forward yet.
这篇关于R中的Mapdeck程序包-add_grid似乎不呈现任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!