tif = system.file("tif/L7_ETMs.tif", package = "stars")
x = read_stars(tif)
st_rgb(x[,,,3:1])
r = st_rgb(x[,,,c(6,5,4,3)], 3, use_alpha=TRUE) # now R=6,G=5,B=4,alpha=3
if (require(ggplot2)) {
ggplot() + geom_stars(data = r) + scale_fill_identity()
}
r = st_rgb(x[,,,3:1],
probs = c(0.01, 0.99),
stretch = "percent")
plot(r)
r = st_rgb(x[,,,3:1],
probs = c(0.01, 0.99),
stretch = "histogram")
plot(r)
Run the code above in your browser using DataLab