用小叶绘制带半径的圆形标记

时间:2017-09-06 10:10:54

标签: r leaflet

我有一个数据集zipdata,如下所示:

 $ zipcode  : int  123 124 125 126
 $ latitude : num  28.4 18.6 12.6 22.3
 $ longitude: num  77.1 74.3 77.3 88.2
 $ adultpop : int  15000 12000 9000 16000
 $ income   : int  5000 2000 9500 1000

如果这是有效的:

leaflet(data = zipdata) %>%
  clearShapes() %>% 
  addTiles() %>%
  addCircles(~longitude, ~latitude, radius = (zipdata$income/max(zipdata$income))*300000,
             layerId = ~zipcode, stroke = FALSE, fillOpacity = 0.4)

为什么这不起作用?如果我运行它,它不会给我我想要的半径:

leaflet(data = zipdata) %>%
   clearShapes() %>%
   addTiles() %>%
   addCircles(~longitude, ~latitude, radius = (zipdata[,5]/max(zipdata[,5]))*300000,
              layerId = ~zipcode, stroke = FALSE, fillOpacity = 0.4)

0 个答案:

没有答案