Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(stars)
library(classInt)
# Data
r = read_stars(system.file("tif/L7_ETMs.tif", package = "stars"))
# Plot
b = classIntervals(r[[1]], 10, "equal")
b = b$brks
for(i in 1:dim(r)[3]) {
plot(r[,,,i], breaks = b, col = hcl.colors(10, "Spectral"), reset = FALSE, axes = TRUE, main = st_get_dimension_values(r, 3)[i], key.pos = 4)
contour(r[,,,i], levels = b, add = TRUE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment