if (FALSE) {
# Using viridis palette
theme_data <- palette_to_lut(viridisLite::viridis(5))
# Using a palette function directly
theme_data <- palette_to_lut(viridisLite::plasma, n = 7)
# Using RColorBrewer
theme_data <- palette_to_lut(RColorBrewer::brewer.pal(9, "YlOrRd"))
# Use in mapboxgl (requires Mapbox GL JS v3+)
mapboxgl(
center = c(139.7, 35.7),
zoom = 10,
config = list(
basemap = list(
theme = "custom",
"theme-data" = theme_data
)
)
)
}
Run the code above in your browser using DataLab