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

better error messages #805

Open
mtennekes opened this issue Oct 25, 2023 · 3 comments
Open

better error messages #805

mtennekes opened this issue Oct 25, 2023 · 3 comments

Comments

@mtennekes
Copy link
Member

tm_shape(World)


tm_shape(World) +  tm_fill("pop_est_dens", fill.scale = tm_scale_intervals(c("yellow", "orange", "red"))) + tm_facets(by = "continent")

tm_shape(World) +  tm_fill("pop_est_dens",
fill.scale = tm_scale_intervals(c("yellow", "orange", "red"))) + tm_facets(by = "continent")
@olivroy
Copy link
Contributor

olivroy commented Mar 28, 2024

I have a suggestion.

While trying to convert my code to v4, I encountered the following:

v3 code detected: as of tmap v4, tm_legend should be specified per visual variable (e.g. with the argument fill.legend of tm_polygons

Here is what I would suggest instead:

v3 code detected: as of tmap v4, the legend should be specified for each visual variable (e.g. with fill.legend = tm_legend() inside tm_polygons to control the legend of fill for polygons.

+ v3 code detected: as of tmap v4, the legend should be specified for each visual variable (e.g. with `fill.legend = tm_legend()` inside tm_polygons to control the legend of `fill` for polygons.
- v3 code detected: as of tmap v4, tm_legend should be specified per visual variable (e.g. with the argument fill.legend of tm_polygons

@olivroy
Copy link
Contributor

olivroy commented May 8, 2024

tm_shape(World)

  • 1 on this one. in v3, we had Error: no layer elements defined after tm_shape, which was more helpful than the current one

mtennekes added a commit that referenced this issue May 8, 2024
@mtennekes
Copy link
Member Author

tm_shape(World)

  • 1 on this one. in v3, we had Error: no layer elements defined after tm_shape, which was more helpful than the current one

Improved! It doesn't cause an error, because a single tm_shape may be handy:

tm_shape(World)
#> [nothing to show] no data layers defined after tm_shape

# without data layers, but with an aux layer
tm_shape(World) + tm_grid() # should this cause a warning? It may be on purpose...

# a single tm_shape to set crs and bbox:
tm_shape(NLD_muni) + tm_shape(World) + tm_polygons()

# with facets...
tm_shape(NLD_muni) + tm_shape(World) + tm_polygons() + tm_facets(by = "continent")

# ... the is.main argument can be used:
tm_shape(NLD_muni) + tm_shape(World, is.main = TRUE) + tm_polygons() + tm_facets(by = "continent")

Created on 2024-05-08 with reprex v2.1.0

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