修改R传单标记的大小

问题描述 投票:0回答:1

有人知道是否可以减小R小叶标记的大小?

请在下面找到可重现的示例

library(leaflet)
leaflet(data = quakes[1:80,]) %>% addTiles() %>%
  addAwesomeMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))

我想减少这些标记的大小,以便更好地区分它们。有什么建议吗?

enter image description here

r leaflet markers
1个回答
0
投票

R Leaflet docs有一个关于自定义标记图标的部分。

它们表明,如果您指向图像(您当前指向默认图像),则可以调整大小和位置参数。这是他们给出的代码:

greenLeafIcon <- makeIcon(
  iconUrl = "http://leafletjs.com/examples/custom-icons/leaf-green.png",
  iconWidth = 38, iconHeight = 95,
  iconAnchorX = 22, iconAnchorY = 94,
  shadowUrl = "http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
  shadowWidth = 50, shadowHeight = 64,
  shadowAnchorX = 4, shadowAnchorY = 62
)

leaflet(data = quakes[1:4,]) %>% addTiles() %>%
  addMarkers(~long, ~lat, icon = greenLeafIcon)

因此,如果你指向你想要的图像并减少iconWidth值,你应该达到你所要求的。

© www.soinside.com 2019 - 2024. All rights reserved.