使用丰度数据生成全球海洋热图
generate Global oceanic heatmap with abundance data
我有全球海洋中不同地理位置的物种丰度。我想生成一个热图,用颜色渐变显示我的物种的丰度。 Here is the header of the data
R 或 R 代码中是否有任何包可以帮助我将其可视化为热图(地理)?
提前致谢
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
我有全球海洋中不同地理位置的物种丰度。我想生成一个热图,用颜色渐变显示我的物种的丰度。 Here is the header of the data
R 或 R 代码中是否有任何包可以帮助我将其可视化为热图(地理)?
提前致谢
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