R小叶自定义归因字符串 [英] R Leaflet custom attribution string

查看:72
本文介绍了R小叶自定义归因字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆