tmap
tmap copied to clipboard
Document `tm_legend()` + add examples
I am trying to upgrade some code to v4, and I noticed that tm_legend()
lacks documentation.
World |>
tm_shape() +
tm_polygons(
fill = "HPI",
legend.format = list(
fun = function(x) scales::dollar(x)
)
)
Furthermore, upgrading the previous code to v4 syntax is the following.
World |>
tm_shape() +
tm_polygons(
fill = "HPI",
fill.scale = tm_scale(
label.format = list(
fun = function(x) scales::dollar(x)
)
))
Is there a simpler way to do it?
I didn't get it on the first try as I attempted to do this first, but it didn't work (and didn't warn either)
World |>
tm_shape() +
tm_polygons(
fill = "HPI",
fill.legend = tm_legend(
format = list(
fun = function(x) scales::dollar(x)
)
)
)