我正在创建一个客户端仪表板。我有客户的 ISO 国家代码,我也使用 rworldmap 包在地图中绘制了相同的国家代码,但 UI 不是很好。
所以,我想使用传单包。如何在创建地图时使用这些 ISO 国家代码 ALPHA 2。
谢谢!
我正在创建一个客户端仪表板。我有客户的 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 = " "))
})
希望这可以帮助!!