我正在努力创建一个客户端仪表板。我有客户的ISO国家代码,我也使用rworldmap包在地图上绘制了相同的代码,但UI不是很好。
所以,我想使用传单包。如何使用这些 ISO 国家/地区代码 ALPHA 2 创建地图。
谢谢!
Leaflet 不接受 ISO Alpa2 代码,而是接受 ISO Alpha3 代码。在经历了几乎所有地方之后,我尝试了这个,它解决了我的问题。
output$myMapOne = renderPlotly({
height = 1000
units="px"
clientName = input$clientSelector
conWiseSub = subset(conData, conData$GCA_CSTMR_DS == clientName)
defOne = aggregate(CNT ~ CODE, conWiseSub, sum)
d = defOne$CODE
e = defOne$CNT
# light grey boundaries
l <- list(color = toRGB("grey"), width = 0.5)
# specify map projection/options
g <- list(
showframe = TRUE,
showcoastlines = FALSE,showland = TRUE,showcountries = TRUE,
countrycolor = toRGB("white"),
landcolor = toRGB("grey85"),
projection = list(type = 'Mercator', scale =1)
)
plot_ly(defOne, z = e, text = d,locations = d, type = 'choropleth',
color = e, colors = 'PuBu', marker = list(line = l), colorbar = list(title = "SOI Distribution")
) %>%
layout( geo = g,title= paste("Region Wise SOI Distribution of", clientName , sep = " "))
})
单击此处查看代码创建的地图
希望这有帮助!!