Skip to content

Commit

Permalink
working on tm_rgb examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Jul 19, 2024
1 parent 40ee0de commit b1b2dc2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/tm_rgb.R
Original file line number Diff line number Diff line change
@@ -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])))

0 comments on commit b1b2dc2

Please sign in to comment.