2017-04-12 71 views
0

我有以下數據框。如何在單張標記中輸入數字(圓圈)

head(branches) 
# A tibble: 6 × 4 
    population_percentage  Lat  Long  Freq 
        <chr> <dbl> <dbl>  <dbl> 
1     0.6 % 41.99575 21.43122 0.005875253 
2     0.6 % 41.99575 21.43122 0.006253363 
3     0.8 % 41.99575 21.43122 0.008405683 
4     1 % 41.98857 21.45733 0.009816326 
5     1.1 % 41.99977 21.42708 0.010528918 
6     1.2 % 42.00731 21.36529 0.011750505 

使用小冊子,我繪製了地圖。

leaflet(branches) %>% addTiles() %>% 
    addCircles(lng = ~Long, lat = ~Lat, weight = 10, color = "#03F", opacity = 0.5, 
      radius = ~sqrt(Freq) * 30, popup = ~ population_percentage  
) 

我想現在要做的,是讓bubles(或圓形),如下面的例子所示opulation_percentage內。

enter image description here

有人嗎?

回答

2

我不知道你在找什麼,但如果你想組項目,並與圈內的數字告訴他們你可以使用clusterOptions = markerClusterOptions()addCirclesaddCircleMarkers

+0

是的,即時尋找正是(HTTPS: //github.com/Leaflet/Leaflet.markercluster/blob/master/example/map.png)。但我不知道如何指定代碼。 – Prometheus

+0

'leaflet(branches)%>%addTiles()%>% addCircles(lng =〜Long,lat =〜Lat,weight = 10,color =「#03F」,opacity = 0.5, radius =〜sqrt )* 30,popup =〜population_percentage,clusterOptions = markerClusterOptions() )'這是行不通的? – krish

+0

不,我試過了。我得到以下錯誤:錯誤addCircles(。,lng =〜Long,lat =〜Lat,weight = 10,color =「#03F」,: 未使用的參數(clusterOptions = markerClusterOptions()) – Prometheus