这与我的问题R using Heatmaps in Leaflet
有关我设法创建了我的热图,但我似乎没有任何渐变的颜色。所以例如我有一大块红色的热量,在我的2万点上有一个小的绿色边框,但似乎没有任何颜色变化。
当我放大聚类时,细分成更小的聚类,这是非常棒的但是在极高区域和非常小的聚类区域之间没有任何颜色变化所有点都保持红色。我错过了一个选项吗?
以下是可重复的示例
library(leaflet)
library(leaflet.extras)
library(dplyr)
library(readr)
library(htmltools)
library(htmlwidgets)
# Heat Map
heatPlugin <- htmlDependency("Leaflet.heat", "99.99.99",
src = c(href = "http://leaflet.github.io/Leaflet.heat/dist/"),
script = "leaflet-heat.js"
)
registerPlugin <- function(map, plugin) {
map$dependencies <- c(map$dependencies, list(plugin))
map
}
# Build our colour Scheme for what i would like to use
colfunc <- colorRampPalette(c("lightblue","yellow","Red"))
leaflet(quakes) %>% addProviderTiles(providers$CartoDB.DarkMatter) %>%
setView( 178, -20, 5 ) %>%
addHeatmap(lng = ~long, lat = ~lat, intensity = ~mag,
blur = 20, max = 0.05, radius = 15)
更新:
只是为了提供一些清晰的内容。关于闪亮的这个问题的答案包含热图,但显示红色,缺少渐变,我试图改变:Creating Leaflet heatmaps in r and shiny using rCharts