tmap
tmap copied to clipboard
better error messages
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")
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 offill
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
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
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