From b1b2dc292f619c9dd04a63b3f4881f451aeaa41c Mon Sep 17 00:00:00 2001 From: mtennekes Date: Fri, 19 Jul 2024 17:58:04 +0200 Subject: [PATCH] working on tm_rgb examples --- examples/tm_rgb.R | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 examples/tm_rgb.R diff --git a/examples/tm_rgb.R b/examples/tm_rgb.R new file mode 100644 index 00000000..29fad091 --- /dev/null +++ b/examples/tm_rgb.R @@ -0,0 +1,31 @@ +file = system.file("tif/L7_ETMs.tif", package = "stars") + +L7 = stars::read_stars(file) + +# not working yet #819 +tm_shape(L7) + + tm_rgb() + +tm_shape(L7) + + tm_rgb(col = tm_mv_dim("band", 1:3)) + +tm_shape(L7) + + tm_rgba(col = tm_mv_dim("band", 1:4)) + +library(stars) +L7_alt = split(L7, "band") + +# not working yet #819 +tm_shape(L7_alt) + + tm_rgb() + +tm_shape(L7_alt) + + tm_rgb(col = tm_mv("X1", "X2", "X3")) + +tm_shape(L7_alt) + + tm_rgb(col = tm_mv(1:3)) + +L7_terra = terra::rast(file) + +tm_shape(L7_terra) + + tm_rgb(col = do.call(tm_mv, as.list(names(L7_terra)[1:3])))