在R的传单中,我无法重现一个标准的示例来说明图标的工作方式

这是其中最常见的传单示例之一。但是,当我运行此代码时,在海洋或图例中看不到红色和绿色的叶子图标,而是看到带有问号的蓝色方块。虽然背景图是正确的。

library(leaflet)

# Sample Data
data(quakes)
quakes <- quakes[1:10,]

# Choose Icon:
leafIcons <- icons(
  iconUrl = ifelse(quakes$mag < 4.6,"http://leafletjs.com/docs/images/leaf-green.png","http://leafletjs.com/docs/images/leaf-red.png"
  ),iconWidth = 38,iconHeight = 95,iconAnchorX = 22,iconAnchorY = 94)

html_legend <- "<img src='http://leafletjs.com/docs/images/leaf-green.png'>green<br/>
<img src='http://leafletjs.com/docs/images/leaf-red.png'>red"

# Produce Map:
leaflet(data = quakes) %>% addTiles() %>%
  addMarkers(~long,~lat,icon = leafIcons) %>%
  addControl(html = html_legend,position = "bottomleft")
wwchwoeoprpr 回答:在R的传单中,我无法重现一个标准的示例来说明图标的工作方式

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3134802.html

大家都在问