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 involving popup.vars when creating non interactive map #766

Closed
Robinlovelace opened this issue Sep 6, 2023 · 2 comments
Closed

Error involving popup.vars when creating non interactive map #766

Robinlovelace opened this issue Sep 6, 2023 · 2 comments

Comments

@Robinlovelace
Copy link
Collaborator

See example below from latest version of v4:

# first intro plot -----------------------------------------------------------
library(terra)
#> terra 1.7.46
library(sf)
#> Linking to GEOS 3.11.1, GDAL 3.6.4, PROJ 9.1.1; sf_use_s2() is TRUE
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
# tmap_mode()
library(spData)
set.seed(2021-09-09)
small_ras = rast(matrix(1:16, 4, 4, byrow = TRUE))
crs(small_ras) = "EPSG:4326"
polys = st_as_sf(as.polygons(small_ras, na.rm = FALSE))
polys$lyr.1 = as.character(polys$lyr.1)
polys$vals = sample.int(100, 16)
polys$vals[c(7, 9)] = "NA"
suppressWarnings({polys$valsn = as.numeric(polys$vals)})

tm1 = tm_shape(polys) +
  tm_borders(col = "black") +
  tm_text(text = "lyr.1") +
  tm_title("A. Cell IDs") +
  tm_layout(frame = FALSE)

tm2 = tm_shape(polys) +
  tm_borders(col = "black") +
  tm_text(text = "vals")  +
  tm_title("B. Cell values") +
  tm_layout(frame = FALSE)

tm3 = tm_shape(polys) +
  tm_fill(fill = "valsn", 
          fill.scale = tm_scale(values = "RdBu", value.na = "white"),
          fill.legend = tm_legend(show = FALSE)) +
  tm_title("C. Colored values") +
  tm_layout(frame = FALSE)

tmap_arrange(tm1, tm2, tm3, nrow = 1)
#> Error in eval(substitute(expr), e): object 'popup.vars' not found

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

Robinlovelace added a commit to geocompx/geocompr that referenced this issue Sep 6, 2023
mtennekes added a commit that referenced this issue Sep 6, 2023
@Robinlovelace
Copy link
Collaborator Author

This looks like another tmap related error:

 Quitting from lines 905-907 [raster-intro-plot2] (02-spatial-data.Rmd)
Error in `if (width == 0L) ...`:
! missing value where TRUE/FALSE needed
Backtrace:
  1. base::source("code/02-raster-intro-plot2.R", print.eval = TRUE)
  3. tmap:::print.tmap_arrange(yy$value)
  4. tmap:::print_tmap_arrange(x, knit = knit, ..., options = options)
  6. tmap:::print.tmap(tm, vp = viewport(layout.pos.col = nc, layout.pos.row = nr))
  7. tmap:::step2_data(x2)
     ...
 26. base::with.default(...)
 27. base::eval(substitute(expr), data, enclos = parent.frame())
 28. base::eval(substitute(expr), data, enclos = parent.frame())
 30. tmap:::fancy_breaks(...)
 33. base::formatC(...)

Source: https://github.com/geocompx/geocompr/actions/runs/6100804382/job/16555864607#step:4:1326

@Robinlovelace
Copy link
Collaborator Author

Wrong place to post I guess and may no longer be an issue. Thanks Martijn!

Robinlovelace added a commit to geocompx/geocompr that referenced this issue Sep 8, 2023
* Tweak intro

* Shorten intro

* Explain advantages of getting started with R

* More prose refactoring

* Turn some things off, fix CI

See #985 and r-tmap/tmap#766

* Remove errant tmap_mode()

* Remove magick dependency

* Uncomment another line...

* Use ghcr for binder image

* Uncomment tmap-related lines

* Improve description of geocomp in other languages

* Add link to geocompy
github-actions bot pushed a commit to geocompx/geocompr that referenced this issue Sep 8, 2023
* Tweak intro

* Shorten intro

* Explain advantages of getting started with R

* More prose refactoring

* Turn some things off, fix CI

See #985 and r-tmap/tmap#766

* Remove errant tmap_mode()

* Remove magick dependency

* Uncomment another line...

* Use ghcr for binder image

* Uncomment tmap-related lines

* Improve description of geocomp in other languages

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

No branches or pull requests

2 participants