In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "leaflet scatter map example analysis". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
#Load package:
library(plyr)
library(maps)
library(mapdata)
library(leaflet)
library(stringi)
library(maptools)
library(htmltools)
library(RColorBrewer)
library(ggplot2)
For convenience of presentation, the provincial administrative map of china (imported in shp format) is uniformly used here, and the index data is mapped in the provincial capital city coordinates.
Map Material Data Import:
province_city %addTiles()%>% addCircles(lng=~jd,lat=~wd,color = ~pal(type),weight=~size,popup=~city)%>%
addLegend("bottomright",pal=pal,values = ~type,title = "GDP grade",labFormat = labFormat (suffix = "file"),opacity=1)
leaflet(province_city)%>%addTiles()%>% addCircleMarkers(lng=~jd,lat=~wd,color = ~pal(type),radius = ~size,fill=TRUE,popup=~city)
addLegend("bottomright",pal=pal,values = ~type,title = "GDP grade",labFormat = labFormat (suffix = "file"),opacity=1)
Continuous Scale Mapping:
leaflet(province_city)%>%addTiles()%>%
addCircles(lng=~jd,lat=~wd,fillColor=~cPal(size),weight=~size,stroke=FALSE,fillOpacity=0.8,popup=~city)%>%
addLegend("bottomright",pal=cPal,values = ~size,title = "GDP grade",labFormat = labFormat (suffix = "file"),opacity=1)
leaflet(province_city)%>%addTiles()%>%
addCircleMarkers(lng=~jd,lat=~wd,fillColor=~cPal(size),radius = ~size,stroke=FALSE,fillOpacity=0.8,popup=~city)%>%
addLegend("bottomright",pal=cPal,values = ~size,title = "GDP grade",labFormat = labFormat (suffix = "file"),opacity=1)
Several common map style theme effects:
The default point shape works with several common map theme styles:
leaflet(province_city)%>%addProviderTiles("Esri.WorldStreetMap")%>%addMarkers(lng=~jd,lat=~wd,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldImagery")%>%addMarkers(lng=~jd,lat=~wd,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldTerrain")%>%addMarkers(lng=~jd,lat=~wd,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.NatGeoWorldMap")%>%addMarkers(lng=~jd,lat=~wd,popup=~city)
#####################################################################
Solid dot shapes work with several common map theme styles:
leaflet(province_city)%>%addProviderTiles("Esri.WorldStreetMap")%>%addCircles(lng=~jd,lat=~wd,color="red",weight=~size,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldImagery")%>%addCircles(lng=~jd,lat=~wd,color="red",weight=~size,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldTerrain")%>%addCircles(lng=~jd,lat=~wd,color="red",weight=~size,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.NatGeoWorldMap")%>%addCircles(lng=~jd,lat=~wd,color="red",weight=~size,popup=~city)
#####################################################################
Outlined dot shapes work with several common map theme styles:
leaflet(province_city)%>%addProviderTiles("Esri.WorldStreetMap")%>%addCircleMarkers(lng=~jd,lat=~wd,radius=~size,color=~co,fill=TRUE,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldImagery")%>%addCircleMarkers(lng=~jd,lat=~wd,radius=~size,color=~co,fill=TRUE,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.WorldTerrain")%>%addCircleMarkers(lng=~jd,lat=~wd,radius=~size,color=~co,fill=TRUE,popup=~city)
leaflet(province_city)%>%addProviderTiles("Esri.NatGeoWorldMap")%>%addCircleMarkers(lng=~jd,lat=~wd,radius=~size,color=~co,fill=TRUE,popup=~city)
Map types available:
addProviderTiles("Esri.WorldStreetMap") #Light
addProviderTiles("Esri.WorldImagery") #Dark satellite cloud
addProviderTiles("Esri.WorldTerrain") #Bright White
addProviderTiles("Esri.NatGeoWorldMap") #Dark Outline
addProviderTiles("Stamen.Toner") #Third-Party Tiles
addProviderTiles("Acetate.terrain") #
addProviderTiles("CartoDB.Positron")
addProviderTiles("Stamen.TonerLabels") #
The content of "leaflet scattered map example analysis" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.