问题添加图标和图例与传单
我尝试在 r markdown 中重复以下代码,但会遇到: “ htmltools::tags$polygon(id = “diamond”,points = draw_diamond(width = width,:尝试应用非功能) 中出现错误”。 如何解决这个问题?
代码来自这里: https:// /roh.engineering/posts/2021/05/map-symbols-and-size-legends-for-leaflet/
library(leaflet)
library(leaflegend)
data("quakes")
symbols <- makeSizeIcons(
values = quakes$depth,
shape = 'diamond',
color = 'red',
fillColor = 'red',
opacity = .5,
baseSize = 10
)
leaflet() %>%
addTiles() %>%
addMarkers(data = quakes,
icon = symbols,
lat = ~lat, lng = ~long) %>%
addLegendSize(
values = quakes$depth,
color = 'red',
fillColor = 'red',
opacity = .5,
title = 'Depth',
shape = 'diamond',
orientation = 'horizontal',
breaks = 5)
I try to reduplicate the below code in r markdown, but meet:
"Error in htmltools::tags$polygon(id = "diamond", points = draw_diamond(width = width, : attempt to apply non-function".
how to solve this problem?
and code is from here: https://roh.engineering/posts/2021/05/map-symbols-and-size-legends-for-leaflet/
library(leaflet)
library(leaflegend)
data("quakes")
symbols <- makeSizeIcons(
values = quakes$depth,
shape = 'diamond',
color = 'red',
fillColor = 'red',
opacity = .5,
baseSize = 10
)
leaflet() %>%
addTiles() %>%
addMarkers(data = quakes,
icon = symbols,
lat = ~lat, lng = ~long) %>%
addLegendSize(
values = quakes$depth,
color = 'red',
fillColor = 'red',
opacity = .5,
title = 'Depth',
shape = 'diamond',
orientation = 'horizontal',
breaks = 5)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论