Skip to contents

tmap 4 - tmap 3.x

  • tmap 3.x supports several map layer variables, for example "col", "size", and "shape" for the tm_symbols() map layer function. There will be many more of those variables in tmap 4. Besides the visual variables, so-called transformation variables also will be available. A transformation variable role is to change the spatial coordinates (for instance, to create a cartogram). A visual variable only changes the appearance of a spatial object, e.g. fill color or line width. You can find some examples of these variables below.

  • Map layer arguments (e.g. the arguments of tm_polygons()) are much better organized: for each visual/transformation variable, there are only four arguments. In the case of the fill visual variable, these are: fill, fill.scale, fill.legend and fill.free, which respectively specify the data variable or visual value that defines the polygon fill color, the used scaling function, the legend layout, and whether scales are applied freely across facets.

  • The input for each visual/transformation variable can be multivariate, in the sense that multiple data variables are scaled to one transformation of a visual variable. An example is a bivariate choropleth, in which a cross tabulation of two data variables is mapped to one (bivariate) color palette.

  • User-defined map layer functions can be written (e.g. as an extension package).

  • Like tmap 3.x, tmap 4.0 comes with two modes, a "plot" and a "view" mode. However, other modes can be added as well, so you may expect an extension package tmap.rayshader at some point (or start writing one yourself).

  • Legends and other map components (such as scale bars) can be drawn anywhere on or outside the map.

  • The layout of legends has been improved and made much more flexible.

  • It is possible to combine legends, which is useful if the same data variable is applied to multiple visual variables using the same scaling function.