What are the actual parameters to be set in terra::stretch
to emulate terra::plotRGB(,stretch="lin")
?
I do:
library(terra)
b <- rast(system.file("ex/logo.tif", package="terra"))
plot(stretch(b[[1]],minq=0.02, maxq=.98),col=grey.colors(64),axes=FALSE,legend=FALSE)
plotRGB(b, stretch="lin", r=1,g=1,b=1)
and it is not exactly the same.
It seems to me that the difference is in the plotting, not in the stretching. To compare the stretching, a better comparison would be
library(terra)
b <- rast(system.file("ex/logo.tif", package="terra"))
s <- stretch(b, minq=0.02, maxq=.98)
par(mfrow=c(1,2))
plotRGB(s, r=1, g=1, b=1)
plotRGB(b, stretch="lin", r=1, g=1, b=1)
And then I do not see any differences. Or compare like this (use the entire gray palette, from black to white)
plot(s[[1]], col=grey(c(0:255)/255), axes=FALSE, legend=FALSE, mar=0)
plotRGB(b, stretch="lin", r=1, g=1, b=1)