【问题标题】:generate Global oceanic heatmap with abundance data生成具有丰富数据的全球海洋热图
【发布时间】:2019-10-12 23:22:37
【问题描述】:

我在全球海洋的不同地理位置拥有丰富的物种。我想生成一个热图,用颜色渐变显示我的物种的丰度。 Here is the header of the data

R 或 R 代码中是否有任何包可以帮助我将其可视化为热图(地理)?

提前致谢

【问题讨论】:

  • 使用ggmapleaflet 等有很多方法可以做到这一点!请发送reproducible example 并更具体。
  • 谢谢!我正在尝试 "oceanmap" ,它不起作用。我会尝试建议的包。

标签: r plot heatmap geography


【解决方案1】:

leaflet 真的很强大,真心推荐这个库。

这是一个例子:

> library(leaflet)
> fishes <- data.frame(lat=c(-47.2,-20.4,-20.9),long=c(-57.9,-3.2,-35.2),abudance=c(5,1,17),samples=c("s1","s2","s3"))
> fishes
    lat  long abudance samples
1 -47.2 -57.9        5      s1
2 -20.4  -3.2        1      s2
3 -20.9 -35.2       17      s3

> leaflet(fishes) %>% addTiles() %>%
+     addCircles(lng = ~long, lat = ~lat, weight = 1,
+                radius = ~abudance *20000, popup = ~samples
+     ) %>% addTiles() %>% addMarkers(~long, ~lat, popup = ~as.character(abudance), label = ~as.character(abudance))

上面的代码会生成这个:

要自定义弹出窗口和点,请参阅以下页面:

https://rstudio.github.io/leaflet/markers.html

https://rstudio.github.io/leaflet/popups.html

https://rstudio.github.io/leaflet/colors.html

【讨论】:

  • 非常感谢,这正是我要找的
猜你喜欢
  • 2021-09-24
  • 2014-02-01
  • 2016-01-22
  • 1970-01-01
  • 1970-01-01
  • 2011-06-24
  • 2011-06-03
  • 2022-01-27
  • 1970-01-01
相关资源
最近更新 更多