有人知道是否可以减小R小叶标记的大小?
请在下面找到可重现的示例
library(leaflet)
leaflet(data = quakes[1:80,]) %>% addTiles() %>%
addAwesomeMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
我想减少这些标记的大小,以便更好地区分它们。有什么建议吗?
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
值,你应该达到你所要求的。