Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/r-tmap/tmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Aug 19, 2024
2 parents d92d7b1 + 0fd2ce9 commit db0ec66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* In view mode, `hover` is now independent from `id` (#851).

* `tm_vars()` is a new function for multivariate scale (#819)

# tmap 3.3-4
- (!) last version of tmap 3.x. Next CRAN version will be tmap 4.x (release planned at the end of 2023)
- fixed bug (some stars appeared upside down in plot mode)
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-terra-stars.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("terra works", {
# FIXME this is not expected.

tm_shape(landsat) +
tm_rgb(tm_mv("landsat_4", "landsat_3", "landsat_2"), col.scale = tm_scale_rgb(maxValue = 31961))
tm_rgb(tm_vars(c("landsat_4", "landsat_3", "landsat_2"), multivariate = TRUE), col.scale = tm_scale_rgb(maxColorValue = 31961))
# Defaults of stars and terra are identical.
tm_shape(landsat) + tm_raster(col.free = FALSE)
tm_shape(landsat) +
Expand Down Expand Up @@ -65,7 +65,7 @@ test_that("multi rast works.", {
})

tm_shape(multi_rast) +
tm_rgb(tm_mv("landsat_4", "landsat_3", "landsat_2"), col.scale = tm_scale_rgb(maxValue = 31961))
tm_rgb(tm_vars(c("landsat_4", "landsat_3", "landsat_2"), multivariate = TRUE), col.scale = tm_scale_rgb(maxColorValue = 31961))

})

Expand All @@ -76,11 +76,11 @@ test_that("Both approaches work for stars.", {
# direct approach
landsat_stars = stars::read_stars(system.file("raster/landsat.tif", package = "spDataLarge"))
expect_no_condition(tm_shape(landsat_stars) +
tm_rgb(tm_mv_dim("band", c(4,3,2)), col.scale = tm_scale_rgb(maxValue = 31961))
tm_rgb(tm_vars("band", dimvalues = c(4,3,2)), col.scale = tm_scale_rgb(maxColorValue = 31961))
)

# indirect approach
landsat_stars2 = split(landsat_stars, "band")
tm_shape(landsat_stars2) +
tm_rgb(tm_mv("X4", "X3", "X2"), col.scale = tm_scale_rgb(maxValue = 31961))
tm_rgb(tm_vars(c("X4", "X3", "X2"), multivariate = TRUE), col.scale = tm_scale_rgb(maxColorValue = 31961))
})
2 changes: 1 addition & 1 deletion tests/testthat/test-v3.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test_that("v3 syntax works", {

skip_if_not_installed("cartogram")
# Cartogram
NLD_prov_pop <- cartogram::cartogram(NLD_prov, "population")
NLD_prov_pop <- cartogram::cartogram_cont(NLD_prov, "population")
tm_shape(NLD_prov_pop) +
tm_polygons("origin_non_west", title = "Non-western origin (%)")
})
Expand Down

0 comments on commit db0ec66

Please sign in to comment.