我是一位有用的助手,将为您翻译以下内容:“我正在制作一个R地图,在这张地图上,每个人口普查区都有相应的数字。是否可以使标签显示在地图上,无论是在滚动中还是通过图层控制单选按钮?”
“这些标签已经包含在形状文件中:”
“这些标签已经包含在形状文件中:”
map1<-leaflet()%>%
addTiles()%>%
addPolygons(data = plotMerge,
fillColor = ~pal(plotMerge$incomePerCapita),
color = "#000000", #this is an outline color hoping to
fillOpacity = 0.8, # add the labels inside this outline
weight = 0.2,
popup=popup)%>%
addLegend(pal = pal,
values = plotMerge$incomePerCapita,
position = "bottomright",
title = "State-wide Income Percentiles",
labFormat = labelFormat(digits=1))
saveas(map1, "map1.html")
map1
addPolygons
中将字符向量简单地传递给label =
参数。 - TimSalabim