if (FALSE) {
library(mapgl)
mapboxgl(
style = mapbox_style("dark"),
center = c(-120, 50),
zoom = 2
) |>
add_heatmap_layer(
id = "earthquakes-heat",
source = list(
type = "geojson",
data = "https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson"
),
heatmap_weight = interpolate(
column = "mag",
values = c(0, 6),
stops = c(0, 1)
),
heatmap_intensity = interpolate(
property = "zoom",
values = c(0, 9),
stops = c(1, 3)
),
heatmap_color = interpolate(
property = "heatmap-density",
values = seq(0, 1, 0.2),
stops = c(
"rgba(33,102,172,0)", "rgb(103,169,207)",
"rgb(209,229,240)", "rgb(253,219,199)",
"rgb(239,138,98)", "rgb(178,24,43)"
)
),
heatmap_opacity = 0.7
)
}
Run the code above in your browser using DataLab