可以通过以下步骤实现:
install.packages("plotly")
install.packages("maps")
library(plotly)
library(maps)
download.file("https://github.com/plotly/datasets/raw/master/geojson/iran-provinces.geojson", "iran-provinces.geojson")
iran_map <- geojsonio::geojson_read("iran-provinces.geojson", what = "sp")
map <- plot_geo()
map <- add_trace(map, z = ~id, locations = ~id, text = ~name, color = I("blue"), alpha = 0.5, data = iran_map, type = "choropleth")
map <- add_text(map, x = ~centroid_lon, y = ~centroid_lat, text = ~name, data = iran_map, showlegend = FALSE)
map <- layout(map, title = "Iran Provinces", geo = list(scope = "asia", projection = list(type = "equirectangular")))
map
这样就可以使用R中的plot_geo将省份标注添加到伊朗地图了。请注意,这里的代码示例中没有提及腾讯云相关产品和产品介绍链接地址,因为这些信息需要根据具体的需求和场景来确定。
领取专属 10元无门槛券
手把手带您无忧上云