tmap v4 is a major release and has been rewritten from scratch. It contains a ton of new features. Although we did our best to make changes backwards compatible, some things may not work as expected.
-
tm_vars()
is a new function for multivariate scale (#819) -
New family of functions
tm_chart_*()
to do charting (See?tm_chart
) (#581) -
Default styles have been updated and palettes now use the cols4all package for enhanced accessibility (#906)
-
tmap now uses visual variables
- For consistency with ggplot2,
tm_polygons()
now recognizes thefill
argument instead ofcol
. - Similarly,
border.col
is nowcol
.
- For consistency with ggplot2,
-
New vignettes available to explain how to upgrade your code to tmap v4.
-
In view mode,
hover
is now independent fromid
(#851). -
tm_credits()
now works in view mode (#806). -
Popup variables have been revamped.
We introduced messages to make it easier for you to upgrade your code (#961, #928, #854)
Functions
tm_scale_bar()
->tm_scalebar()
- As of version 4.0,
tm_scalebar()
is used instead oftm_scale_bar()
because of the potential confusion with thetm_scale_*()
scaling functions (liketm_scale_continuous()
). tm_format()
and friends are now deprecated (#976).
Arguments
projection
->crs
(intm_shape()
,tm_grid()
)
-
The internal structure of a tmap object is not compatible with tmap v3. Therefore, some tests may fail.
-
tmap exports many functions to make it easier to create an extension (#866) See
?tmap_internal
.
-
tmap now requires R 3.6 and above.
-
datasets were reviewed and use a more recent crs. (#967, #665)
-
Usage of the cli package for messages.
- (!) last version of tmap 3.x. Next CRAN version will be tmap 4.x
- fixed bug (some stars appeared upside down in plot mode)
- fixed newly introduced shiny bug (#767)
- added device to
tmap_save()
- fixed many small bugs (see GitHub issue list)
World
s has been fixed (it is now 's2' proof, see GitHub issue #564)
- fixed view titles
- added html.escape to
popup.format
to control whether html code is escaped in view popups - fixed many small bugs (see GitHub issue list)
tmap_grob()
added, which exports tmap plots togrob
objects (grid package)SpatRaster
objects (terra package) supported- fixed many small bugs (see GitHub issue list)
tmap_animation()
improved: now using av and gifski under the hood; added progress bar; lists of tmap objects supported; improved default settings- improved
tmapOutput()
; it now works with reactive shiny objects - improved internally used margins; also small exported maps look good (see example
tmap_save()
) - improved
tmap_design_mode()
;tmap.design.mode
is now a global option (and not a tmap option anymore) - reexported providers from
leafet
- added
show.warnings
totmap_options()
- added
width
argument totm_credits()
tm_text()
improved: added "id" argument, andtm_remove_layer()
can be applied to it
- interactive maps in origin CRS working:
tmap_options(projection = 0, basemaps = NULL)
- added
tm_mouse_coordinates()
to show mouse coordinates in view mode - added
tmap_design_mode()
to toggle the design mode. - made background symbol grob shapes transparent
- added in.iframe and
selfcontained
totmap_save()
- improved
tm_add_legend()
: addedtype = "title"
for title only legend elements - added
ttmp()
which shows the last map in the other mode. - fixed many small bugs (see GitHub issue list)
- [!] spatial rasters/arrays now implemented using the stars package (instead of the raster package)
as.count
argument added to layer functions; numeric variables can be treated as count variables (integers)- drop.levels argument added to layer functions which allows to drop unused levels
- new style added for color classes: "dpih" and "headtails"; also added style.args to pass on arguments to
classInt::classIntervals()
- grid labels specification per axis
- fixed bug with geometry collection
- probably last version before release of tmap 3.0
- many small improvements and bug fixes (see GitHub)
- first stars supported (full support expected in tmap 3.0)
- replaced projection shortcuts with
"epsg/proj4strings"
in examples
- improved popups in view mode
- added validity checks for
sf
objects - minor bugs fixed: see GitHub issue list
- [!] shiny integration: added
tmapOutput()
,renderTmap()
,tmapProxy()
, and,tm_remove_layer()
- improved
tmap_save()
(regarding default values) - improved
tm_rgb()
(added r g b and max.value arguments) - added
tm_graticules()
- supported TMS servers
- in view mode, layers can be hidden from the legend with
group = NULL
- replaced
mapview
byleafsync
- minor bugs fixed: see GitHub issue list
- improved
tm_rgb()
- improved breaks in interactive maps
- added
bbox
argument toqtm()
- improved projection shortcut codes (using EPSG database)
- fixed several bugs (see GitHub)
- fixed two small bugs
- added option max.raster (maximum raster size)
- made rasters in view mode faster
- bug fixed for geometry collection objects without data in view mode
- improved handling of manual palettes
tmap_arrange()
can take a list of tmap objects
- [!] tmap migrated from sp to sf. sp objects are still supported, but all internal functions are based on sf
- [!] added
tm_sf()
which draws sf objects - [!] renamed all
*_tmap()
functions (e.g.save_tmap()
) totmap_*()
for consistency - [!] added
tm_basemap()
andtm_tiles()
: now, multiple (overlay) tiled maps can be shown - [!] rearranged tmap options, styles and formats. See
tmap_options()
,tmap_style()
,tmap_format()
,tm_style()
andtm_format()
- [!] added
filter
argument totm_shape()
and addedcolorNULL
to layer functions - added
tm_minimap()
- added
remove.NA.facets
totm_facets()
- units data columns are supported
tmap_animation()
enhanced with loop options- added
tmap_tips()
- all changes are backwards compatible with 1.11-2
- vignettes rewritten, including a vignette that describes the changes of 2.0
- added references to JSS paper (including citation)
- fixed bug in labels argument of
tm_fill()
- fixed bug regarding legend symbols in facets with free scales
- fixed bug in rasters in view mode
- improved popup width in view mode
- added
text.align
andtext.to.columns
tolegend.format
legend.(aes).reverse
added to the layer functions- symbol shapes can be put in a list for small multiples, and named according the values of the variable specified with the shape argument
- grid labels can now be rotated and formatted
- changed default values of
free.coords
anddrop.units
intm_facets()
- fixed bug with all NAs in view mode
- fixed bug with
dismo::gmap()
raster shapes - fixed bug for ambiguous values for aesthetics (e.g. when "blue" is also a variable name)
- NOTE: this will be the last version before the major update (in which sf fully replaces sp)
- [!]
tm_scale_bar()
,tm_text()
, andtm_grid()
now supported in view mode (requires leaflet 1.1.0) - added
along
argument totm_facets()
, which enables faceting along multiple pages (or animation frames) - added
main.title
argument to tm_layout - added
tmap_options()
, including the new optiontmap.unit
("metric" or "imperial"") - improved automatic labelling of breaks
- improved legend in view mode: missing values are shown by default (like in plot mode)
- improved bubble scaling in view mode
- fixed bug aspect ratio bug
- added
tm_rgb()
(shortcut for rgb rasters) - fixed interactive maps in R Markdown
- fixed bug in
qtm()
called without arguments
- [!] package split: non-plotting functions migrated to tmaptools
- added
tmap_arrange()
for arranging custom small multiples - added
simplify
argument totm_shape()
- added error message for NA-projected shapes in view mode
- improved unit handling, which now can be set to metric or imperial
- NA values allowed in direct color variables
- sf (simple features) objects supported
- improved projections: code is more efficient now and shortcuts are renewed. Also, CRS objects are now supported for all project arguments (e.g.
tm_shape()
, set_projection), and as.CRS is added to get_projection and get_proj4. - Rscript works: methods is moved from imports to depends
- [!]
tm_symbols()
added, to create proportional symbol maps: besides bubbles, it also supports other symbol shapes, png icons, and small ggplot2 plots - [!] imported cartogram function from cartogram package (thanks Sebastian!)
- [!] reverse geocoding function
tmaptools::rev_geocode_OSM()
added - [!]
tm_logo()
added - added
popup.vars
to base layer functions - bounding box (argument
bbox
intm_shape()
) working in view mode tmaptools::geocode_OSM()
improved: aSpatialPointsDataFrame
can now be returnedlast_tmap()
added, which retrieves the last produced map- crop_shape can also handle polygons as cropping area
- append_data improved; the under and over coverage information can be retrieved with under_coverage and over_coverage
- interpolate parameter added to
tm_raster()
- added support for custom legend formatting functions
- legend items can now be stacked horizontally
- legend width and height can be determined fully manually (with negative values for
legend.height
andlegend.width
) - argument
interval.closure
added to layer functions to determine where intervals are closed - added warnings for non-supported elements in view mode
- fixed raster brick bug
- fixed save_tmap/get_asp_ratifo bug
- add
just
argument as anchor for text labels, legend and attributes position - map attributes (such as scale bar) can be placed outside the frame
- added
tm_xlab()
andtm_ylab()
- RGB raster support, see tm_raster
- static text (i.e titles, credits, legend titles, labels) support expressions
- updated Europe shape: projection and bounding box are now consistent with Eurostat publications
- added crop_shape, a convenient wrapper around
raster::crop()
- [!] interactive mapping added. Now, tmap has two modes: "plot" (graphics device) and "view" (interactive viewer, which is a leaflet widget)
- [!] facets (small multiples) improved: group by two variables possible, panel layout added, missing data can be shown separately
- added
geocode_OSM()
, a function to find coordinates (nowtmaptools::geocode_OSM()
) - improved set_projection for raster objects
- added
double_line
andoffset_line
- added insets option in
save_tmap
- improved default settings for contrast argument regarding seq and div palettes
- improved automatic positions of legend and map attributes (more specifically, legend snaps to right-hand side without need to adjust legend.width, and legend and attributes position improved when double frame is enabled)
- improved
tm_layouts()
's design.mode output lwd
parameter added totm_scale_bar()
andtm_compass()
- fixed
bb
bug
- fixed bug with PROJ.4 version < 4.9.1
- improved error messages
- rd projection reset to
"+init=epsg:28992"
, since the latter now has a"+towgs"
item - fixed bug of
print.tmap()
returned object
- added
read_osm()
, a function to read Open Street Map data (nowtmaptools::read_osm()
) - added
bb
, a handy bounding box function - added layout themes with tm_style and tm_format
- added automatic text labeling
- added interactive SVG, that can be opened in RStudio (see itmap)
- added map compass (
tm_compass()
) - added text aesthetics
size
andcol
- added automatic map coloring
- added earth boundary, which is useful for projected world maps
World
- added warped grid lines (e.g. long-lat lines can be shown in projected maps)
- added new color scale modes (enabled with
style="cat"
, "cont", and "order") - added
save_tmap()
- added smooth_map, smooth_raster_cover, sample_dots, points_to_raster and poly_to_raster
- added read_GPX
- improved automatic layout regarding title, legend, and map attributes
- layer arguments, e.g. palette, can take multiple values for small multiples
- improved grid lines (labels can also be placed outside frame)
- arguments
free.coords
anddrop.shapes
oftm_facets()
working - updated examples and vignette
- fixed
viewport
bug - see
?tmap
for a structured overview of all tmap functions
- added
tm_credits()
andtm_scale_bar()
- added
is.master
argument totm_shape()
, that determines which shape is the master - added
unit
andunit.size
arguments totm_shape()
that correlates the coordinates with the desired units - added
tm_polygons()
, which is a combination oftm_fill()
andtm_borders()
- fixed several small bugs
- added
tm_raster()
- improved legend behavior: legend titles should be set in the layer functions (instead of in
tm_layout()
) - removed
crop_shape()
, sinceraster::crop()
does the same job, but, but faster - out-of-scope functions migrated to spatialToolbox package, available on https://github.com/mtennekes/spatialToolbox
- fixed bug in
scale
parameter (global scale set intm_layout()
)
- enhanced small multiples (
tm_facets()
) with respect to scaling and free coordinate scales - added
alpha
argument totm_layers()
for transparency - added text shadow argument
- added function
split()
to split a shape object andsbind()
to combine shape objects. - added automatic legend positioning when
legend.position = NULL
- improved number formatting in legend
- improved
inner.margins
andouter.margins
. Both can take one value (e.g.outer.margins=0
rather thanouter.margins=c(0,0,0,0))
- improved
qtm()
:tm_facets()
parameters working, and also fixed scale parameter bug - improved all examples for
approx_areas
,calc_densities
- fixed bug regarding drawing a frame with
outer.margins=0
. - fixed bug in plotting bubbles
- improved temp file handling in
animation_tmap()
- added functions to get and set polygon directions, and to calculate the intersection ratios of polygons (intersection_shapes)
- this is the the first CRAN version
- a newer version may be available on https://github.com/r-tmap/tmap
- to get started, see the package vignette 'tmap in a nutshell' and the help files
- if you have any questions or suggestions, please contact me (mtennekes at gmail dot com)