Skip to content

Instantly share code, notes, and snippets.

@michaeldorman
Created September 27, 2020 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeldorman/7ae3e6c9f1df1612fc5fb418c5fa7c23 to your computer and use it in GitHub Desktop.
Save michaeldorman/7ae3e6c9f1df1612fc5fb418c5fa7c23 to your computer and use it in GitHub Desktop.
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