Suggestion: sd style labels
@mtennekes I have three ideas for improvement of the sd style. Let me know what you think about it.
- Automatic labels for this style (how much the values deviates from the mean) (see image at the bottom)
- Middle class containing the values around the mean (e.g. -0.5 sd to 0.5 sd). Right now, there are two middle class - one below and one above the mean.
- Automatic diverging palette when the
sdstyle is used.
library(tmap)
library(spData)
mean(world$lifeExp, na.rm = TRUE)
#> [1] 70.85439
sd(world$lifeExp, na.rm = TRUE)
#> [1] 8.209522
tm_shape(world) +
tm_polygons("lifeExp", style = "sd")
#> Linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.2

Created on 2020-10-09 by the reprex package (v0.3.0)

I forgot about this one.
Very interesting, and for v4 low-hanging fruit. All we have to do is add another 'style' option in tm_scale_intervals.
We only have to think about the title and legend labels. For the title, we can add " (deviation from mean)" or "(\nDeviation from Mean)", but for the legend items it is tricker: the 'suffix' argument of label.format in tm_scale_x is meant for numbers rather than intervals. Perhaps a new argument to the label.format list? (Which should ideally be tm_label_format(), but I'll leave that for another time.