Learn R Programming

tmap (version 1.6-1)

tmap_arrange: Arrange small multiples in grid layout

Description

Arrange small multilples in a grid layout. Normally, small multiples are created by specifying multiple variables for one aesthetic or by specifying the by argument (see tm_facets). This function can be used to arrange custom small multiples in a grid layout.

Usage

tmap_arrange(..., ncol = NA, nrow = NA, sync = FALSE, asp = 0, outer.margins = 0.02)

Arguments

...
tmap objects. The number of multiples that can be plot is limited (see details).
ncol
number of columns
nrow
number of rows
sync
logical. Should the navigation in view mode (zooming and panning) be synchronized? By default FALSE.
asp
aspect ratio. If will overwrite the asp argument from tm_layout, unless set to NULL
outer.margins
outer.margins, numeric vector four or a single value. If defines the outer margins for each multiple. If will overwrite the outer.margins argument from tm_layout, unless set to NULL.

Details

The global option tmap.limits controlls the limit of the number of facets that are plotted. By default, options(tmap.limits=c(facets.view=4, facets.plot=64)). The maximum number of interactive facets is set to four since otherwise it may become very slow.

Examples

Run this code
data(World)
w1 <- qtm(World, projection = "eck4", title="Eckert IV")
w2 <- qtm(World, projection = "merc", title="Mercator")
w3 <- qtm(World, projection = "wintri", title="Winkel-Tripel")
w4 <- qtm(World, projection = "robin", title="Robinsin")

current.mode <- tmap_mode("plot")
tmap_arrange(w1, w2, w3, w4)
tmap_mode(current.mode)

Run the code above in your browser using DataLab