if (interactive()) {
# Generate random data
lon <- runif(100, min = 8.49, max = 8.56)
lat <- runif(100, min = 47.35, max = 47.42)
green_index <- runif(100, min = 0, max = 1)
data <- data.frame(lon = lon, lat = lat, green_index = green_index)
data_sf <- sf::st_as_sf(data, coords = c("lon", "lat"), crs = 4326)
# Specify your Mapbox access token
mapbox_token <- "your_mapbox_access_token_here"
# Create the 3D hexagon map
create_hexmap_3D(
data = data_sf,
value_col = "green_index",
mapbox_token = mapbox_token,
output_file = "map.html",
color_palette = "interpolateViridis"
)
}
Run the code above in your browser using DataLab