Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message related to line width #768

Closed
Robinlovelace opened this issue Sep 7, 2023 · 1 comment
Closed

Error message related to line width #768

Robinlovelace opened this issue Sep 7, 2023 · 1 comment
Labels

Comments

@Robinlovelace
Copy link
Collaborator

I think this is a recent regression in v4 and that it works fine in v3.

Reproducible example:

# second intro plot -----------------------------------------------------------
library(tmap)
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#>      (status 2 uses the sf package in place of rgdal)
#> 
#> Attaching package: 'tmap'
#> The following object is masked from 'package:datasets':
#> 
#>     rivers
library(rcartocolor)
library(spDataLarge)
library(terra)
#> terra 1.7.46

# data read ---------------------------------------------------------------
cla_raster = rast(system.file("raster/srtm.tif", package = "spDataLarge"))
cat_raster = rast(system.file("raster/nlcd.tif", package = "spDataLarge"))

# plots create ------------------------------------------------------------
rast_srtm = tm_shape(cla_raster) +
  tm_raster(col.scale = tm_scale_continuous(values = carto_pal(7, "Geyser")),
            col.legend = tm_legend("Elevation (m)")) + 
  tm_title("A. Continuous data") +
  tm_layout(legend.frame = TRUE, 
            legend.bg.color = "white",
            legend.position = c("right", "bottom"))

rast_nlcd = tm_shape(cat_raster) +
  tm_raster(col.scale = tm_scale_categorical(levels.drop = TRUE),
            col.legend = tm_legend("Land cover")) + 
  tm_title("B. Categorical data") +
  tm_layout(legend.frame = TRUE, 
            legend.bg.color = "white",
            legend.position = c("right", "bottom"))

tmap_arrange(rast_srtm, rast_nlcd, nrow = 1)
#> Error in if (width == 0L) width <- digits: missing value where TRUE/FALSE needed

Created on 2023-09-07 with reprex v2.0.2

@Robinlovelace
Copy link
Collaborator Author

This is leading to our CI failing in more than one place so definitely a regression: geocompx/geocompr#984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants