leaflet包用来做地图简直太方便了,地图神器。
下面介绍两个用leaflet做地图展示的方法:
1、按等级展示(按照数据的某个值的变化来控制颜色变化)
library(leaflet)
pal <- colorNumeric(palette = c("green","red","blue"),domain = x1_2006$X3)
leaflet(xb)%>%addProviderTiles("Esri.WorldStreetMap")%>%
addCircleMarkers(fillColor = ~pal(x1_2006$X3),stroke = FALSE,fillOpacity = 0.8,popup=~as.character(x1_2006$X3))%>%
addLegend(