R小叶自定义归因字符串 [英] R Leaflet custom attribution string
问题描述
使用R leaflet
软件包时,如何在属性字符串(例如,右下角的传单| ...")中添加其他内容?
When using the R leaflet
package, how can I add something additional to the attribution string (i.e. the "Leaflet | ..." in the bottom right corner)?
例如,我如何在此地图的归因文本中添加数据源:..."之类的内容:
For example, I how would I add something like "data source: ..." to the attribution text on this map:
leaflet(data = quakes[1:20,]) %>%
addTiles() %>%
addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
推荐答案
您可以将attribution
参数添加到addTiles
:
leaflet(data = quakes[1:20,]) %>%
addTiles(attribution = 'I did this, you hear?! Also Leaflet.') %>%
addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
我很想知道如何使用addProviderTiles
做到这一点,因为这似乎不接受attribution
参数:/
I'd love to know how to do this with addProviderTiles
, though, because that doesn't appear to accept an attribution
argument :/
编辑:好的,我使用提供程序图块的解决方法是仅使用这两个功能.我希望实际上并没有同时调用这两个图块,因为这浪费了用户带宽,但是看起来不错!
okay, my workaround for using provider tiles has been to just use both functions. I hope it's not actually calling both tiles, since that's a bit of a waste of user bandwidth—but hey, it looks fine!
leaflet(data = quakes[1:20,]) %>%
addTiles(attribution = 'I did this, you hear?! Also Leaflet.') %>%
addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
addMarkers(~long, ~lat, popup = ~as.character(mag), label = ~as.character(mag))
这篇关于R小叶自定义归因字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!