I created a dot map with that code
map = st_as_sf(map)
tm_shape(map) + tm_fill("ratio",style = "cont")
I also tried function rev() but nothing work
I created a dot map with that code
map = st_as_sf(map)
tm_shape(map) + tm_fill("ratio",style = "cont")
I also tried function rev() but nothing work
Add legend.col.reverse = TRUE in tm_bubbles(col = "SSEP",scale = 0.45,style="order")
Reproducible example:
library(tmap)
library(tmaptools)
data(World, metro)
metro$growth <- (metro$pop2020 - metro$pop2010) / (metro$pop2010 * 10) * 100
tm_shape(World) +
tm_fill("grey70") +
tm_shape(metro) +
tm_bubbles("pop2010", col = "growth",
border.col = "black", border.alpha = .5,
style="fixed", breaks=c(-Inf, seq(0, 6, by=2), Inf),
palette="-RdYlBu", contrast=1,
title.size="Metro population",
title.col="Growth rate (%)", legend.col.reverse = TRUE) +
tm_format("World")
You need legend.col.reverse. See help(tm_bubbles) for all the legend reversal arguments - I don't see a legend.reverse in my version:
legend.size.reverse = FALSE,
legend.col.reverse = FALSE,
legend.shape.reverse = FALSE,
Example using nc as ever:
tm_shape(nc) + tm_fill("NWBIR74") + tm_bubbles(col="SID79", legend.col.reverse=FALSE, style="order")
tm_shape(nc) + tm_fill("NWBIR74") + tm_bubbles(col="SID79", legend.col.reverse=TRUE, style="order")