根据地图中列的值绘制条形图

draw a bar based on a value of column in a map

我正在使用 map deck 绘制将近 100K 点,是否可以代替点,根据已安装的列的值显示条形图

library(mapdeck)
library(htmlwidgets)
dataset =data.frame(stringsAsFactors=FALSE,
           x = c(143.4865219, 143.4865241, 143.4865264, 143.4865286,
                 143.4865305, 143.4865327),
           y = c(-34.7560602, -34.7561332, -34.7562088, -34.7562818,
                 -34.7563453, -34.7564183),
   installed = c("yes", "yes", "yes", "no", "no", "no")
)
MAPBOX_API_KEY = "xxxxxxxxxx"
test = mapdeck( token = MAPBOX_API_KEY ) %>%
      add_scatterplot(dataset,lon="x",lat="y")%>%
      mapdeck_view(location=center,pitch = 45,zoom=13)
#saveWidget(test, file="C:/Users/mimoune.djouallah/mapdeck.html")
test

我对leaflet也很熟悉,所以我也可以用它,如果它能做到的话。

使用 mapdeck 的开发版本

library(mapdeck)
library(dplyr)
dataset =data.frame(stringsAsFactors=FALSE,
                    x = c(143.4865219, 143.4865241, 143.4865264, 143.4865286,
                          143.4865305, 143.4865327),
                    y = c(-34.7560602, -34.7561332, -34.7562088, -34.7562818,
                          -34.7563453, -34.7564183),
                    installed = c("yes", "yes", "yes", "no", "no", "no")
)
center=c(mean(dataset$x),mean(dataset$y))

MAPBOX_API_KEY ="xxxxxxx"
test = mapdeck( token = MAPBOX_API_KEY ) %>%
  add_column(filter(dataset,installed=="yes"),
             lon="x",
             lat="y",
             elevation = 3,
             disk_resolution = 5
             , radius = 0.9)%>%
  add_scatterplot(filter(dataset,installed=="no"),
                  lon="x",
                  lat="y")%>%
  mapdeck_view(location=center,pitch = 45,zoom=14)
test