From efb444e020a1c78da47299d8e54e9991d163b92d Mon Sep 17 00:00:00 2001 From: olivroy Date: Mon, 18 Sep 2023 12:33:21 -0400 Subject: [PATCH] Manual corrections done --- R/data.R | 8 ++++---- R/pkg.R | 12 ++++++------ R/qtm.R | 4 ++-- R/tm_components.R | 2 +- R/tm_element.R | 2 +- R/tm_facets.R | 8 ++++---- R/tm_layers_aux.R | 8 ++++---- R/tm_layers_lines.R | 2 +- R/tm_layers_polygons.R | 2 +- R/tm_layers_sf.R | 2 +- R/tm_layers_text.R | 8 ++++---- R/tm_layout.R | 10 +++++----- R/tm_pos.R | 17 ++++++++--------- R/tm_scale_.R | 16 ++++++++-------- R/tm_scale_bivariate.R | 6 +++--- R/tm_shape.R | 2 +- R/tmap_arrange.R | 8 ++++---- R/tmap_format.R | 2 +- R/tmap_icons.R | 2 +- R/tmap_leaflet.R | 11 +++++++---- R/tmap_mode.R | 4 ++-- R/tmap_options.R | 33 ++++++++++++++++----------------- R/tmap_save.R | 12 ++++++------ R/tmap_style.R | 4 ++-- man/Shapes.Rd | 2 +- man/land.Rd | 2 +- man/metro.Rd | 2 +- man/qtm.Rd | 4 ++-- man/rivers.Rd | 2 +- man/tm_basemap.Rd | 4 ++-- man/tm_facets.Rd | 8 ++++---- man/tm_grid.Rd | 4 ++-- man/tm_lines.Rd | 2 +- man/tm_plot.Rd | 2 +- man/tm_polygons.Rd | 2 +- man/tm_pos.Rd | 16 ++++++++-------- man/tm_scale.Rd | 4 ++-- man/tm_scale_bivariate.Rd | 6 +++--- man/tm_scale_categorical.Rd | 6 +++--- man/tm_scale_continuous.Rd | 2 +- man/tm_scale_discrete.Rd | 4 ++-- man/tm_scalebar.Rd | 2 +- man/tm_sf.Rd | 2 +- man/tm_shape.Rd | 2 +- man/tm_text.Rd | 8 ++++---- man/tm_view.Rd | 8 ++++---- man/tmap-package.Rd | 12 ++++++------ man/tmapAddLayerOptions.Rd | 2 +- man/tmap_arrange.Rd | 8 ++++---- man/tmap_format.Rd | 2 +- man/tmap_icons.Rd | 2 +- man/tmap_last.Rd | 2 +- man/tmap_leaflet.Rd | 19 +++++++++++++++---- man/tmap_mode.Rd | 4 ++-- man/tmap_options.Rd | 4 ++-- man/tmap_save.Rd | 12 ++++++------ man/tmap_style.Rd | 4 ++-- 57 files changed, 181 insertions(+), 169 deletions(-) diff --git a/R/data.R b/R/data.R index 8c792395..19f92a37 100644 --- a/R/data.R +++ b/R/data.R @@ -1,6 +1,6 @@ #' World and Netherlands map #' -#' Maps of the world and the Netherlands (province and municipality level), class [sf::sf()] +#' Maps of the world and the Netherlands (province and municipality level), class [`sf`][`sf::sf`] #' #' The default projections for these maps are Eckhart IV (World) and Rijksdriehoekstelsel (Netherlands). See below. The projection can be changed temporarily for plotting purposes by using the projection argument of [tm_shape()]. #' @@ -33,7 +33,7 @@ NULL #' Spatial data of rivers #' -#' Spatial data of rivers, of class [sf::sf()] +#' Spatial data of rivers, of class [`sf`][`sf::sf`] #' #' @usage data(rivers) #' @name rivers @@ -43,7 +43,7 @@ NULL #' Spatial data of metropolitan areas #' -#' Spatial data of metropolitan areas, of class [sf::sf()]. The data includes a population times series from 1950 to (forecasted) 2030. All metro areas with over 1 million inhabitants in 2010 are included. +#' Spatial data of metropolitan areas, of class [`sf`][`sf::sf`]. The data includes a population times series from 1950 to (forecasted) 2030. All metro areas with over 1 million inhabitants in 2010 are included. #' #' @usage data(metro) #' @name metro @@ -54,7 +54,7 @@ NULL #' Spatial data of global land cover #' -#' Spatial data of global land cover, percent tree cover, and elevation of class [`stars()`][stars::st_as_stars]. +#' Spatial data of global land cover, percent tree cover, and elevation of class [`stars`][stars::st_as_stars()]. #' Two attributes in this object relates to global land cover. #' The cover layer classifies the status of land cover of the whole globe into 20 categories, while #' the cover_cls layer uses 8 simplified categories. diff --git a/R/pkg.R b/R/pkg.R index 19678465..59c25b73 100644 --- a/R/pkg.R +++ b/R/pkg.R @@ -98,12 +98,12 @@ #' #' @section Spatial datasets: #' \tabular{ll}{ -#' [World()]\tab World country data ([sf::sf()] object of polygons) \cr -#' [NLD_prov()]\tab Netherlands province data ([sf::sf()] object of polygons) \cr -#' [NLD_muni()]\tab Netherlands municipal data ([sf::sf()] object of polygons) \cr -#' [metro()]\tab Metropolitan areas ([sf::sf()] object of points) \cr -#' [rivers()]\tab Rivers ([sf::sf()] object of lines) \cr -#' [land()]\tab Global land cover ([`stars()`][stars::st_as_stars] object)\cr +#' [World()]\tab World country data ([`sf`][`sf::sf`] object of polygons) \cr +#' [NLD_prov()]\tab Netherlands province data ([`sf`][`sf::sf`] object of polygons) \cr +#' [NLD_muni()]\tab Netherlands municipal data ([`sf`][`sf::sf`] object of polygons) \cr +#' [metro()]\tab Metropolitan areas ([`sf`][`sf::sf`] object of points) \cr +#' [rivers()]\tab Rivers ([`sf`][`sf::sf`] object of lines) \cr +#' [land()]\tab Global land cover ([`stars`][stars::st_as_stars()] object)\cr #' --------------------------- \tab --------------------------------------------------------------------------------------------------- \cr #' } #' diff --git a/R/qtm.R b/R/qtm.R index a7b69fc6..f7e00f7d 100644 --- a/R/qtm.R +++ b/R/qtm.R @@ -8,7 +8,7 @@ #' #' @param shp One of #' \itemize{ -#' \item shape object, which is an object from a class defined by the [sf::sf()] or [`stars()`][stars::st_as_stars] package. Objects from the packages `sp` and `raster` are also supported, but discouraged. +#' \item shape object, which is an object from a class defined by the [`sf`][`sf::sf`] or [`stars`][stars::st_as_stars()] package. Objects from the packages `sp` and `raster` are also supported, but discouraged. #' \item Not specified, i.e. `qtm()` is executed. In this case a plain interactive map is shown. #' \item A OSM search string, e.g. `qtm("Amsterdam")`. In this case a plain interactive map is shown positioned according to the results of the search query (from OpenStreetMap nominatim) #' } @@ -16,7 +16,7 @@ #' @param by data variable name by which the data is split, or a vector of two variable names to split the data by two variables (where the first is used for the rows and the second for the columns). See also [tm_facets()] #' @param scale numeric value that serves as the global scale parameter. All font sizes, symbol sizes, border widths, and line widths are controlled by this value. The parameters `symbols.size`, `text.size`, and `lines.lwd` can be scaled seperately with respectively `symbols.scale`, `text.scale`, and `lines.scale`. See also `...`. #' @param title main title. For legend titles, use `X.style`, where X is the layer name (see `...`). -#' @param crs Either a [`crs()`][sf::st_crs] object or a character value (`PROJ.4` character string). By default, the projection is used that is defined in the `shp` object itself. +#' @param crs Either a [`crs`][sf::st_crs()] object or a character value (`PROJ.4` character string). By default, the projection is used that is defined in the `shp` object itself. #' @param bbox bounding box. Arugment passed on to [tm_shape()] #' @param basemaps name(s) of the provider or an URL of a tiled basemap. It is a shortcut to [tm_basemap()]. Set to `NULL` to disable basemaps. By default, it is set to the tmap option `basemaps`. #' @param overlays name(s) of the provider or an URL of a tiled overlay map. It is a shortcut to [tm_tiles()]. diff --git a/R/tm_components.R b/R/tm_components.R index 046643cc..df4d3a16 100644 --- a/R/tm_components.R +++ b/R/tm_components.R @@ -142,7 +142,7 @@ tm_compass <- function(north, #' Map component: scale bar #' -#' Map component that adds a scale bar. As of version 4.0, `tm_scalebar` is used instead of `tm_scale_bar` (now deprecated), because of the potential confusion with the `tm_scale_x` scaling functions (like [tm_scale_continuous()]). +#' Map component that adds a scale bar. As of version 4.0, `tm_scalebar()` is used instead of `tm_scale_bar` (now deprecated), because of the potential confusion with the `tm_scale_x` scaling functions (like [tm_scale_continuous()]). #' #' @param breaks breaks #' @param width width diff --git a/R/tm_element.R b/R/tm_element.R index e2979f1d..e2ee59de 100644 --- a/R/tm_element.R +++ b/R/tm_element.R @@ -39,7 +39,7 @@ tm_element_list_sel = function(tml, subclass) { #' Retrieve the last map to be modified or created #' -#' Retrieve the last map to be modified or created. Works in the same way as `ggplot2`'s [ggplot2::last_plot()], although there is a difference: `last_map` returns the last call instead of the stacked `[tmap-element]s`. +#' Retrieve the last map to be modified or created. Works in the same way as [ggplot2::last_plot()], although there is a difference: `last_map()` returns the last call instead of the stacked [`tmap-element`]s. #' #' @return call #' @export diff --git a/R/tm_facets.R b/R/tm_facets.R index 67f7c227..b6e2be7f 100644 --- a/R/tm_facets.R +++ b/R/tm_facets.R @@ -1,6 +1,6 @@ #' Facets #' -#' Specify facets. `tm_facets` is the core function, but recommended is to use `tm_facets_wrap`, `tm_facets_stack` or `tm_facets_grid`. The former two specify facets for one grouping variable (so one faceting dimension). The difference is that wrap may place facets in multiple rows and columns whereas `tm_facets_stack` stacks the facets either horizontally or vertically. `tm_facets_grid` supports up to three faceting dimensions. +#' Specify facets. `tm_facets()` is the core function, but recommended is to use `tm_facets_wrap()`, `tm_facets_stack()` or `tm_facets_grid()`. The former two specify facets for one grouping variable (so one faceting dimension). The difference is that wrap may place facets in multiple rows and columns whereas `tm_facets_stack()` stacks the facets either horizontally or vertically. `tm_facets_grid()` supports up to three faceting dimensions. #' #' @param by Group by variable (only for a facet wrap or facet stack) #' @param rows Variable that specifies the rows (only for a facet grid) @@ -16,11 +16,11 @@ #' @param drop.empty.facets Logical. If the `by` argument is specified, should empty facets be dropped? Empty facets occur when the `by`-variable contains unused levels. When `TRUE` and two `by`-variables are specified, empty rows and columns are dropped. #' @param drop.NA.facets Logical. If the `by` argument is specified, and all data values for specific facets are missing, should these facets be dropped? `FALSE` by default. #' @param sync Logical. Should the navigation in view mode (zooming and panning) be synchronized? By default `TRUE` if the facets have the same bounding box. This is generally the case when rasters are plotted, or when free.coords is `FALSE`. -#' @param showNA If the `by` argument is specified, should missing values of the `by`-variable be shown in a facet? If two `by`-variables are specified, should missing values be shown in an additional row and column? If `NA`, missing values only are shown if they exist. Similar to the `useNA` argument of [base::table()], where `TRUE`, `FALSE`, and `NA` correspond to `"always"`, `"no"`, and `"ifany"` respectively. +#' @param showNA If the `by` argument is specified, should missing values of the `by`-variable be shown in a facet? If two `by`-variables are specified, should missing values be shown in an additional row and column? If `NA`, missing values only are shown if they exist. Similar to the `useNA` argument of [table()][base::table()], where `TRUE`, `FALSE`, and `NA` correspond to `"always"`, `"no"`, and `"ifany"` respectively. #' @param textNA Text used for facets of missing values. #' @param scale.factor Number that determines how the elements (e.g. font sizes, symbol sizes, line widths) of the small multiples are scaled in relation to the scaling factor of the shapes. The elements are scaled to the `scale.factor`th root of the scaling factor of the shapes. So, for `scale.factor=1`, they are scaled proportional to the scaling of the shapes. Since elements, especially text, are often too small to read, a higher value is recommended. By default, `scale.factor=2`. #' @param type `"grid"`, `"wrap"` or `"stack"` -#' @param along deceprated Please use `tm_facets_page` +#' @param along deceprated Please use `tm_facets_page()` #' @export #' @rdname tm_facets #' @name tm_facets @@ -104,7 +104,7 @@ tm_facets_grid = function(rows = NULL, #' @export #' @rdname tm_facets -#' @param ... paseed on to `tm_facets` +#' @param ... paseed on to `tm_facets()` #' @name tm_facets_wrap tm_facets_wrap = function(by = "VARS__", nrows = NA, diff --git a/R/tm_layers_aux.R b/R/tm_layers_aux.R index ae719323..07e0bb9a 100644 --- a/R/tm_layers_aux.R +++ b/R/tm_layers_aux.R @@ -1,8 +1,8 @@ #' Map layer: basemap / overlay tiles #' -#' Map layer that draws tiles from a tile server. The function `tm_basemap` draws the tile layer as basemap, i.e. as bottom layer. In contrast, `tm_tiles` draws the tile layer as overlay layer, where the stacking order corresponds with the order in which this layer is called, just like other map layers. +#' Map layer that draws tiles from a tile server. `tm_basemap()` draws the tile layer as basemap, i.e. as bottom layer. In contrast, `tm_tiles()` draws the tile layer as overlay layer, where the stacking order corresponds with the order in which this layer is called, just like other map layers. #' -#' @param server Name of the provider or an URL. The list of available providers can be obtained with `providers` (tip: in RStudio, type `providers$` to see the options). See for a preview of those. When a URL is provided, it should be in template format, e.g. \code{"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}. Use `NULL` in `tm_basemap` to disable basemaps. +#' @param server Name of the provider or an URL. The list of available providers can be obtained with `providers` (tip: in RStudio, type `providers$` to see the options). See for a preview of those. When a URL is provided, it should be in template format, e.g. \code{"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}. Use `NULL` in `tm_basemap()` to disable basemaps. #' @param alpha Transparency level #' @param zoom Zoom level (only used in plot mode) #' @param zindex zindex of the pane in view mode. By default, it is set to the layer number plus 400. By default, the tmap layers will therefore be placed in the custom panes `"tmap401"`, `"tmap402"`, etc., except for the base tile layers, which are placed in the standard `"tile"`. This parameter determines both the name of the pane and the z-index, which determines the pane order from bottom to top. For instance, if `zindex` is set to 500, the pane will be named `"tmap500"`. @@ -55,7 +55,7 @@ tm_graticules = function(x = NA, #' Coordinate grid / graticule lines #' -#' Creates a [tmap-element()] that draws coordinate grid lines. It serves as a layer that can be drawn anywhere between other layers. By default, `tm_grid` draws horizontal and vertical lines acording to the coordinate system of the (master) shape object. Latitude and longitude graticules are drawn with `tm_graticules`. +#' Creates a [`tmap-element`] that draws coordinate grid lines. It serves as a layer that can be drawn anywhere between other layers. By default, `tm_grid()` draws horizontal and vertical lines acording to the coordinate system of the (master) shape object. Latitude and longitude graticules are drawn with `tm_graticules()`. #' #' @param x X coordinates for vertical grid lines. If `NA`, it is specified with a pretty scale and `n.x`. #' @param y Y coordinates for horizontal grid lines. If `NA`, it is specified with a pretty scale and `n.y`. @@ -76,7 +76,7 @@ tm_graticules = function(x = NA, #' \item{scientific}{Should the labels be formatted scientifically? If so, square brackets are used, and the `format` of the numbers is `"g"`. Otherwise, `format="f"`, and `text.separator`, `text.less.than`, and `text.or.more` are used. Also, the numbers are automatically rounded to millions or billions if applicable.} #' \item{format}{By default, `"f"`, i.e. the standard notation `xxx.xxx`, is used. If `scientific=TRUE` then `"g"`, which means that numbers are formatted scientifically, i.e. `n.dddE+nn` if needed to save space.} #' \item{digits}{Number of digits after the decimal point if `format="f"`, and the number of significant digits otherwise.} -#' \item{...}{Other arguments passed on to [base::formatC()]} +#' \item{...}{Other arguments passed on to [formatC()]} #' } #' @param labels.cardinal Add the four cardinal directions (N, E, S, W) to the labels, instead of using negative coordinates for west and south (so it assumes that the coordinates are positive in the north-east direction). #' @param labels.margin.x Margin between tick labels of x axis and the frame. Note that when `labels.inside.frame == FALSE` and `ticks == TRUE`, the ticks will be adjusted accordingly. diff --git a/R/tm_layers_lines.R b/R/tm_layers_lines.R index 4876b19c..6a170ff1 100644 --- a/R/tm_layers_lines.R +++ b/R/tm_layers_lines.R @@ -14,7 +14,7 @@ #' @param lwd,lwd.scale,lwd.legend,lwd.free Visual variable that determines the line width. See details. #' @param lty,lty.scale,lty.legend,lty.free Visual variable that determines the line type. See details. #' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free Visual variable that determines the border color alpha transparency. See details. -#' @param linejoin,lineend line join and line end. See [grid::gpar()] for details. +#' @param linejoin,lineend line join and line end. See [gpar()][grid::gpar()] for details. #' @param plot.order Specification in which order the spatial features are drawn. See [tm_plot_order()] for details. #' @param trans.args,mapping.args lists that are passed on to internal transformation and mapping functions respectively #' @param zindex Map layers are drawn on top of each other. The `zindex` numbers (one for each map layer) determines the stacking order. By default the map layers are drawn in the order they are called. diff --git a/R/tm_layers_polygons.R b/R/tm_layers_polygons.R index 7e7329fd..e8d9a09c 100644 --- a/R/tm_layers_polygons.R +++ b/R/tm_layers_polygons.R @@ -16,7 +16,7 @@ #' @param lty,lty.scale,lty.legend,lty.free Visual variable that determines the line type. See details. #' @param fill_alpha,fill_alpha.scale,fill_alpha.legend,fill_alpha.free Visual variable that determines the fill color alpha transparency See details. #' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free Visual variable that determines the border color alpha transparency. See details. -#' @param linejoin,lineend Line join and line end. See [grid::gpar()] for details. +#' @param linejoin,lineend Line join and line end. See [gpar()][grid::gpar()] for details. #' @param plot.order Specification in which order the spatial features are drawn. See [tm_plot_order()] for details. #' @param trans.args,mapping.args lists that are passed on to internal transformation and mapping functions respectively #' @param zindex Map layers are drawn on top of each other. The `zindex` numbers (one for each map layer) determines the stacking order. By default the map layers are drawn in the order they are called. diff --git a/R/tm_layers_sf.R b/R/tm_layers_sf.R index bbafe1fb..034542f7 100644 --- a/R/tm_layers_sf.R +++ b/R/tm_layers_sf.R @@ -18,7 +18,7 @@ #' @param lty,lty.scale,lty.legend,lty.free Visual variable that determines the line type. See details. #' @param fill_alpha,fill_alpha.scale,fill_alpha.legend,fill_alpha.free Visual variable that determines the fill color alpha transparency See details. #' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free Visual variable that determines the border color alpha transparency. See details. -#' @param linejoin,lineend line join and line end. See [grid::gpar()] for details. +#' @param linejoin,lineend line join and line end. See [gpar()][grid::gpar()] for details. #' @param plot.order.list Specification in which order the spatial features are drawn. This consists of a list of three elementary geometry types: for polygons, lines and, points. For each of these types, which are drawn in that order, a [tm_plot_order()] is required. #' @param trans.args.list,mapping.args.list lists that are passed on to internal transformation and mapping functions respectively. Each is a list of three items, named `polygons`, `lines`, and `points`. See [tm_polygons()], [tm_lines()], and [tm_dots()]. #' @param zindex Map layers are drawn on top of each other. The `zindex` numbers (one for each map layer) determines the stacking order. By default the map layers are drawn in the order they are called. diff --git a/R/tm_layers_text.R b/R/tm_layers_text.R index 177f5365..8c3381a0 100644 --- a/R/tm_layers_text.R +++ b/R/tm_layers_text.R @@ -8,14 +8,14 @@ #' #' The `.legend` arguments determine the used legend, specified with [tm_legend()]. The default legend and its settings are determined by the tmap options `legend.`. #' -#' The `.free` arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (see [tm_facets()]). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid ([tm_facets_grid()]). For instance, `col.free = c(TRUE, FALSE, FALSE)` means that for the visual variable `col`, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks ([tm_facets_wrap()] and [tm_facets_stack()]) there is only one facet dimension, so the `.free` argument requires only one logical value. +#' The `.free` arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (see [tm_facets()]). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid ([tm_facets_grid()]). For instance, `col.free = c(TRUE, FALSE, FALSE)` means that for the visual variable `col`, each row of facets will has its own scale, and therefore its own legend. For facet wraps and stacks ([tm_facets_wrap()] and [tm_facets_stack()]) there is only one facet dimension, so the `.free` argument requires only one logical value. #' #' @param text,text.scale,text.legend,text.free Visual variable that determines the text. See details. #' @param size,size.scale,size.legend,size.free Visual variable that determines the font size. See details. #' @param col,col.scale,col.legend,col.free Visual variable that determines the col color. See details. -#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free Visual variable that determines the border color alpha transparency. See details. -#' @param fontface,fontface.scale,fontface.legend,fontface.free Visual variable that determines the font face. See details. -#' @param fontfamily The font family. See [grid::gpar()] for details. +#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free Visual variable that determines the border color alpha transparency. See Details. +#' @param fontface,fontface.scale,fontface.legend,fontface.free Visual variable that determines the font face. See Details. +#' @param fontfamily The font family. See [gpar()][grid::gpar()] for details. #' @param shadow Shadow behind the text. Logical or color. #' @param plot.order Specification in which order the spatial features are drawn. See [tm_plot_order()] for details. #' @param trans.args,mapping.args lists that are passed on to internal transformation and mapping functions respectively diff --git a/R/tm_layout.R b/R/tm_layout.R index 014a8133..8d044567 100644 --- a/R/tm_layout.R +++ b/R/tm_layout.R @@ -58,10 +58,10 @@ tm_layout = function( #' @param control.position position of the control attribute #' @param control.bases base layers #' @param control.overlays overlay layers -#' @param set.bounds logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to [leaflet::setMaxBounds()] -#' @param set.view numeric vector that determines the view. Either a vector of three: lng, lat, and zoom, or a single value: zoom. See [leaflet::setView()]. Only applicable if `bbox` is not specified -#' @param set.zoom.limits numeric vector of two that set the minimum and maximum zoom levels (see [leaflet::tileOptions()]). -#' @param leaflet.options options passed on to [leaflet::leafletOptions()] +#' @param set.bounds logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to [setMaxBounds()][leaflet::setMaxBounds()] +#' @param set.view numeric vector that determines the view. Either a vector of three: lng, lat, and zoom, or a single value: zoom. See [setView()][leaflet::setView()]. Only applicable if `bbox` is not specified +#' @param set.zoom.limits numeric vector of two that set the minimum and maximum zoom levels (see [tileOptions()][leaflet::tileOptions()]). +#' @param leaflet.options options passed on to [leafletOptions()][leaflet::leafletOptions()] #' @export tm_view = function(use.WebGL, control.position, @@ -79,7 +79,7 @@ tm_view = function(use.WebGL, #' #' Plot mode options. This option is specific to the plot mode. #' -#' @param use.gradient Use gradient fill using [grid::linearGradient()] +#' @param use.gradient Use gradient fill using [linearGradient()][grid::linearGradient()] #' @export tm_plot = function(use.gradient) { args = lapply(as.list(match.call()[-1]), eval, envir = parent.frame()) diff --git a/R/tm_pos.R b/R/tm_pos.R index 129e56e8..c2fd57a8 100644 --- a/R/tm_pos.R +++ b/R/tm_pos.R @@ -1,6 +1,6 @@ #' Set the position of map components #' -#' Set the position of map components, such as legends, title, compass, scale bar, etc. `tm_pos` is the function to position these components: `tm_pos_out` places the components outside the map area and `tm_pos_in` inside the map area. Each `position` argument of a map layer or component should be specified with one of these functions. The functions `tm_pos_auto_out` and `tm_pos_auto_in` are used to set the components automatically, and are recommended to use globally, via [tmap_options()]. See details how the positioning works. +#' Set the position of map components, such as legends, title, compass, scale bar, etc. `tm_pos()` is the function to position these components: `tm_pos_out()` places the components outside the map area and `tm_pos_in()` inside the map area. Each `position` argument of a map layer or component should be specified with one of these functions. The functions `tm_pos_auto_out()` and `tm_pos_auto_in()` are used to set the components automatically, and are recommended to use globally, via [tmap_options()]. See Details how the positioning works. #' #' @param cell.h,cell.v The plotting area is overlaid with a 3x3 grid, of which the middle grid cell is the map area. Components can be drawn into any cell. `cell.h` specifies the horizontal position (column) can take values `"left"`, `"center"`, and `"right"`, and `cell.v` specifies the vertical position (row) and can take values `"top"`, `"center"`, and `"bottom"`. See details for a graphical explanation. #' @param pos.h,pos.v The position of the component within the cell. The main options for `pos.h` are `"left"`, `"center"`, and `"right"`, and for `cell.v` these are `"top"`, `"center"`, and `"bottom"`. These options can also be provided in upper case; in that case there is no offset (see the tmap option `component.offset`). Also numbers between 0 and 1 can be provided, which determine the position of the component inside the cell (with (0,0) being left bottom). The arguments `just.h` and `just.v` determine the justification point. @@ -12,39 +12,38 @@ #' |---------------:|:---------------|:------------------|:------------------|:------| #' | | +------------------- | +-------------------------------- | +------------------- | + #' | | \| | \| |\| |\| | -#' | "top" | \| | \| |\| |\| | +#' | `"top"` | \| | \| |\| |\| | #' | | \| | \| |\| |\| | #' | | +------------------- | +-------------------------------- | +------------------- | + #' | | \| | \| |\| |\| | #' | | \| | \| |\| |\| | -#' | cell.v  "center"| \| | \|   Map(s) |\| |\| | +#' | `cell.v`  "center"| \| | \|   Map(s) |\| |\| | #' | | \| | \| |\| |\| | #' | | \| | \| |\| |\| | #' | | +------------------- | +-------------------------------- | +------------------- | + #' | | \| | \| |\| |\| | -#' | "bottom" | \| | \| |\| |\| | +#' | `"bottom"` | \| | \| |\| |\| | #' | | \| | \| |\| |\| | #' | | +------------------- | +-------------------------------- | +------------------- | + #' | |   `"left"` |   `"center"` |    `"right"` | | #' | | |   `cell.h` | | | #' -#' `tm_pos_in` sets the position of the component(s) inside the maps area, which is equivalent to the center-center cell (in case there are facets, these are all drawn in this center-center cell). +#' `tm_pos_in()` sets the position of the component(s) inside the maps area, which is equivalent to the center-center cell (in case there are facets, these are all drawn in this center-center cell). #' -#' `tm_pos_out` sets the position of the component(s) outside the map. +#' `tm_pos_out()` sets the position of the component(s) outside the map. #' #' The amount of space that the top and bottom rows, and left and right columns occupy is determined by the [tm_layout()] arguments `meta.margins` and `meta.auto.margins`. The former sets the relative space of the bottom, left, top, and right side. In case these are set to `NA`, the space is set automatically based on 1) the maximum relative space specified by `meta.auto.margins` and 2) the presence and size of components in each cell. For instance, if there is one landscape oriented legend in the center-bottom cell, then the relative space of the bottom row is set to the height of that legend (given that it is smaller than the corresponding value of `meta.auto.margins`), while the other four sides are set to 0. #' -#' `tm_pos_auto_out` is more complex: the `cell.h` and `cell.v` arguments of should be set to one of the four corners. It does not mean that the components are drawn in a corner. The corner represents the sides of the map that the components are drawn. By default, legends are drawn either at the bottom or on the right-side of the map by default (see `tmap_options("legend.position")`). Only when there are row- and column-wise legends and a general legend (using [tm_facets_grid()]), the general legend is drawn in the corner, but in practice this case will be rare. +#' `tm_pos_auto_out()` is more complex: the `cell.h` and `cell.v` arguments of should be set to one of the four corners. It does not mean that the components are drawn in a corner. The corner represents the sides of the map that the components are drawn. By default, legends are drawn either at the bottom or on the right-side of the map by default (see `tmap_options("legend.position")`). Only when there are row- and column-wise legends and a general legend (using [tm_facets_grid()]), the general legend is drawn in the corner, but in practice this case will be rare. #' #' The arguments `pos.h` and `pos.v` determine where the components are drawn within the cell. Again, with `"left"`, `"center"`, and `"right"` for `pos.h` and `"top"`, `"center"`, and `"bottom"` for `pos.v`. The values can also be specified in upper-case, which influences the offset with the cell borders, which is determined by tmap option `component.offset`. By default, there is a small offset when components are drawn inside and no offset when they are drawn outside or with upper-case. #' -#' `tm_pos_auto_in` automatically determines `pos.h` and `pos.v` given the available space inside the map. This is similar to the default positioning in tmap3. +#' `tm_pos_auto_in()` automatically determines `pos.h` and `pos.v` given the available space inside the map. This is similar to the default positioning in tmap3. #' #' In case multiple components are draw in the same cell and the same position inside that cell, they are stacked (determined which the `stack` argument in the legend or component function). The `align.h` and `align.v` arguments determine how these components will be justified with each other. #' #' Note that legends and components may be different for a facet row or column. This is the case when [tm_facets_grid()] or [tm_facets_stack()] are applied and when scales are set to free (with the `.free` argument of the map layer functions). In case a legends or components are draw row- or column wise, and the position of the legends (or components) is right next to the maps, these legends (or components) will be aligned with the maps. #' -#' @md #' @export #' @name tm_pos #' @rdname tm_pos diff --git a/R/tm_scale_.R b/R/tm_scale_.R index 413414cb..60111ecf 100644 --- a/R/tm_scale_.R +++ b/R/tm_scale_.R @@ -18,9 +18,9 @@ tm_shape_vars = function() { #' Scales: automatic scale #' -#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale` is an scale that is set automatically given by the data type (factor, numeric, and integer) and the visual variable. The tmap option `scales.var` contains information which scale is applied when. +#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale()` is a scale that is set automatically given by the data type (factor, numeric, and integer) and the visual variable. The tmap option `scales.var` contains information which scale is applied when. #' -#' @param ... arguments passed on to the applied scale function `tm_scale_` +#' @param ... arguments passed on to the applied scale function `tm_scale_*()` #' @export tm_scale = function(...) { structure(c(list(FUN = "tmapScaleAuto"), list(...)), class = c("tm_scale_auto", "tm_scale", "list")) @@ -52,10 +52,10 @@ tm_scale_ordinal = function(n.max = 30, #' Scales: categorical and ordinal scale #' -#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The functions `tm_scale_categorical` and `tm_scale_ordinal` are used for categorical data. The only difference between these functions is that the former assumes unordered categories whereas the latter assumes ordered categories. For colors (the visual variable `fill` or `col`), different default color palettes are used (see the tmap option `values.var`). +#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The functions `tm_scale_categorical()` and `tm_scale_ordinal()` are used for categorical data. The only difference between these functions is that the former assumes unordered categories whereas the latter assumes ordered categories. For colors (the visual variable `fill` or `col`), different default color palettes are used (see the tmap option `values.var`). #' #' @param n.max Maximum number of categories (factor levels). In case there are more, they are grouped into `n.max` groups. -#' @param values (generic scale argument) The visual values. For colors (e.g. `fill` or `col` for `tm_polygons`) this is a palette name from the `cols4all` package (see [cols4all::c4a()]) or vector of colors, for size (e.g. `size` for `tm_symbols`) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. `shape` for [tm_symbols()]) these are a set of symbols, etc. The tmap option `values.var` contains the default values per visual variable and in some cases also per data type. +#' @param values (generic scale argument) The visual values. For colors (e.g. `fill` or `col` for `tm_polygons()`) this is a palette name from the `cols4all` package (see [cols4all::c4a()]) or vector of colors, for size (e.g. `size` for `tm_symbols()`) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. `shape` for [tm_symbols()]) these are a set of symbols, etc. The tmap option `values.var` contains the default values per visual variable and in some cases also per data type. #' @param values.repeat (generic scale argument) Should the values be repeated in case there are more categories? #' @param values.range (generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as `c(0, 1)`. For instance, when a grey scale is used for color (from black to white), `c(0,1)` means that all colors are used, `0.25, 0.75` means that only colors from dark grey to light grey are used (more precisely `"grey25"` to `"grey75"`), and `0, 0.5` means that only colors are used from black to middle grey (`"grey50"`). When only one number is specified, this is interpreted as the second number (where the first is set to 0). Default values can be set via the tmap option `values.range`. #' @param values.scale (generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as `size` of [tm_symbols()] and `lwd` of [tm_lines()]. @@ -67,7 +67,7 @@ tm_scale_ordinal = function(n.max = 30, #' @param labels (generic scale argument) Labels #' @param label.na (generic scale argument) Label for missing values #' @param label.null (generic scale argument) Label for null (out-of-scope) values -#' @param label.format (generic scale argument) Label formatting (similar to legend.format in tmap3) +#' @param label.format (generic scale argument) Label formatting (similar to `legend.format` in tmap3) #' @export #' @name tm_scale_categorical #' @rdname tm_scale_categorical @@ -134,7 +134,7 @@ tm_scale_intervals = function(n = 5, #' Scales: discrete scale #' -#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale_discrete` is used for discrete numerical data, such as integers. +#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale_discrete()` is used for discrete numerical data, such as integers. #' #' @param ticks Discrete values. If not specified, it is determined automatically: unique values are put on a discrete scale. #' @param midpoint The data value that is interpreted as the midpoint. By default it is set to 0 if negative and positive values are present. Useful when values are diverging colors. In that case, the two sides of the color palette are assigned to negative respectively positive values. If all values are positive or all values are negative, then the midpoint is set to `NA`, which means that the value that corresponds to the middle color class (see `style`) is mapped to the middle color. If it is specified for sequential color palettes (e.g. `"Blues"`), then this color palette will be treated as a diverging color palette. @@ -148,7 +148,7 @@ tm_scale_intervals = function(n = 5, #' @param labels (generic scale argument) Labels #' @param label.na (generic scale argument) Label for missing values #' @param label.null (generic scale argument) Label for null (out-of-scope) values -#' @param label.format (generic scale argument) Label formatting (similar to legend.format in tmap3) +#' @param label.format (generic scale argument) Label formatting (similar to `legend.format` in tmap3) #' @export tm_scale_discrete = function(ticks = NA, #step = NA, @@ -187,7 +187,7 @@ tm_scale_discrete = function(ticks = NA, #' @param labels (generic scale argument) Labels #' @param label.na (generic scale argument) Label for missing values #' @param label.null (generic scale argument) Label for null (out-of-scope) values -#' @param label.format (generic scale argument) Label formatting (similar to legend.format in tmap3) +#' @param label.format (generic scale argument) Label formatting (similar to `legend.format` in tmap3) #' @export #' @rdname tm_scale_continuous #' @name tm_scale_continuous diff --git a/R/tm_scale_bivariate.R b/R/tm_scale_bivariate.R index 159b61c2..4d91e74a 100644 --- a/R/tm_scale_bivariate.R +++ b/R/tm_scale_bivariate.R @@ -1,9 +1,9 @@ #' Scales: bivariate scale #' -#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale_bivariat` is usedf or bivariate.scales +#' Scales in tmap are configured by the family of functions with prefix `tm_scale`. Such function should be used for the input of the `.scale` arguments in the layer functions (e.g. `fill.scale` in [tm_polygons()]). The function `tm_scale_bivariate()` is used or `bivariate.scales`. #' -#' @param scale1,scale2 two `tm_scale` objects. Currently, all `tm_scale_` functions are supported except `tm_scale_continous`. -#' @param values (generic scale argument) The visual values. For colors (e.g. `fill` or `col` for `tm_polygons`) this is a palette name from the `cols4all` package (see [cols4all::c4a()]) or vector of colors, for size (e.g. `size` for `tm_symbols`) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. `shape` for [tm_symbols()]) these are a set of symbols, etc. The tmap option `values.var` contains the default values per visual variable and in some cases also per data type. +#' @param scale1,scale2 two `tm_scale` objects. Currently, all `tm_scale_` functions are supported except `tm_scale_continous()`. +#' @param values (generic scale argument) The visual values. For colors (e.g. `fill` or `col` for `tm_polygons()`) this is a palette name from the `cols4all` package (see [cols4all::c4a()]) or vector of colors, for size (e.g. `size` for `tm_symbols()`) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. `shape` for [tm_symbols()]) these are a set of symbols, etc. The tmap option `values.var` contains the default values per visual variable and in some cases also per data type. #' @param values.repeat (generic scale argument) Should the values be repeated in case there are more categories? #' @param values.range (generic scale argument) Range of the values. Vector of two numbers (both between 0 and 1) where the first determines the minimum and the second the maximum. Full range, which means that all values are used, is encoded as `c(0, 1)`. For instance, when a grey scale is used for color (from black to white), `c(0,1)` means that all colors are used, `0.25, 0.75` means that only colors from dark grey to light grey are used (more precisely `"grey25"` to `"grey75"`), and `0, 0.5` means that only colors are used from black to middle grey (`"grey50"`). When only one number is specified, this is interpreted as the second number (where the first is set to 0). Default values can be set via the tmap option `values.range`. #' @param values.scale (generic scale argument) Scaling of the values. Only useful for size-related visual variables, such as `size` of [tm_symbols()] and `lwd` of [tm_lines()]. diff --git a/R/tm_shape.R b/R/tm_shape.R index 9a22dc95..9b0b06ed 100644 --- a/R/tm_shape.R +++ b/R/tm_shape.R @@ -1,6 +1,6 @@ #' Shape (spatial object) specification #' -#' Specify a shape, which is a spatial object from one of these spatial object class packages: `sf`, `stars`, `terra`. +#' Specify a shape, which is a spatial object from one of these spatial object class packages: [`sf`][`sf::sf`], [`stars`][stars::st_as_stars()], `terra`. #' #' @param shp Spatial object #' @param name Name of the shape diff --git a/R/tmap_arrange.R b/R/tmap_arrange.R index f81255c2..232c29e3 100644 --- a/R/tmap_arrange.R +++ b/R/tmap_arrange.R @@ -2,9 +2,9 @@ #' #' Arrange small multiples 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. #' -#' The global option `tmap.limits` controls the limit of the number of facets that are plotted. By default, `tmap_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. +#' The global option `tmap.limits` controls the limit of the number of facets that are plotted. By default, `tmap_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. #' -#' @param ... [tmap()] objects or one list of [tmap()] objects. The number of multiples that can be plot is limited (see details). +#' @param ... [`tmap`] objects or one list of [`tmap`] objects. The number of multiples that can be plot is limited (see details). #' @param ncol number of columns #' @param nrow number of rows #' @param widths vector of column widths. It should add up to 1 and the length should be equal to `ncol` @@ -12,9 +12,9 @@ #' @param sync logical. Should the navigation in view mode (zooming and panning) be synchronized? By default `FALSE`. #' @param asp aspect ratio. The aspect ratio of each map. Normally, this is controlled by the `asp` argument from [tm_layout()] (also a tmap option). This argument will overwrite it, unless set to `NULL`. The default value for `asp` is 0, which means that the aspect ratio is adjusted to the size of the device divided by the number of columns and rows. When `asp` is set to `NA`, which is also the default value for [tm_layout()], the aspect ratio will be adjusted to the used shapes. #' @param 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`. -#' @param x a `tmap_arrange` object (returned from `tmap_arrange`) +#' @param x a `tmap_arrange` object (returned from `tmap_arrange()`) #' @param knit should [knitr::knit_print()] be enabled, or the normal [base::print()] function? -#' @param options options passed on to knitprint +#' @param options options passed on to [knitr::knit_print()] #' @example ./examples/tmap_arrange.R #' @export tmap_arrange <- function(..., ncol=NA, nrow=NA, widths=NA, heights = NA, sync=FALSE, asp=0, outer.margins=.02) { diff --git a/R/tmap_format.R b/R/tmap_format.R index c277bdeb..cf5dc05a 100644 --- a/R/tmap_format.R +++ b/R/tmap_format.R @@ -1,6 +1,6 @@ #' Get or add format options #' -#' Format options are tmap options that are shape dependent. With `tmap_format()` the predefined formats can be retrieved. The values for a specific format can be retrieved with `tmap_format(format)`, where format is the name of the format. The function `tmap_format_add` is used to add a format. +#' Format options are tmap options that are shape dependent. With `tmap_format()` the predefined formats can be retrieved. The values for a specific format can be retrieved with `tmap_format(format)`, where format is the name of the format. The function `tmap_format_add()` is used to add a format. #' #' @param format Name of the format. Run `tmap_format()` to see the choices. #' @return The function `tmap_format()` returns the names of the available formats. When `format` is defined, it returns the option list corresponding the that format. diff --git a/R/tmap_icons.R b/R/tmap_icons.R index 9144a0ca..0a00ac7e 100644 --- a/R/tmap_icons.R +++ b/R/tmap_icons.R @@ -1,6 +1,6 @@ #' Specify icons #' -#' Specifies icons from a png images, which can be used as markers in thematic maps. The function `marker_icon` is the specification of the default marker. +#' Specifies icons from a png images, which can be used as markers in thematic maps. The function `marker_icon()` is the specification of the default marker. #' #' @param file character value/vector containing the file path(s) or url(s). #' @param width width of the icon. If `keep.asp`, this is interpreted as the maximum width. diff --git a/R/tmap_leaflet.R b/R/tmap_leaflet.R index 39ae45e9..ae12b84a 100644 --- a/R/tmap_leaflet.R +++ b/R/tmap_leaflet.R @@ -1,11 +1,14 @@ #' Export tmap to the format of the used graphics mode #' -#' Export tmap to the format of the used graphics mode. `tmap_grid` returns a [grid::grob()] object (`"plot" mode`) and `tmap_leaflet` a [leaflet::leaflet()] object (`"view"` mode). +#' * `tmap_grid()` returns a [`grob`][grid::grob()] object (`"plot" mode`) +#' * `tmap_leaflet()` a [`leaflet`][leaflet::leaflet()] object (`"view"` mode). #' -#' @param x description +#' @param x a tmap object. #' @param show show the map? -#' @param ... arguments passed on the [print.tmap()] -#' @return `tmap_grid` returns a [grid::grob()] object (`"plot"` mode) and `tmap_leaflet` a [leaflet::leaflet()] object (`"view"` mode). In case small multiples are shown, a list is returned. +#' @inheritDotParams print.tmap +#' @return +#' * `tmap_grid()` returns a [`grob`][grid::grob()] object (`"plot"` mode) +#' * `tmap_leaflet()` a [`leaflet`][leaflet::leaflet()] object (`"view"` mode). In case small multiples are shown, a list is returned. #' @export #' @examples #' map = tm_shape(World) + tm_polygons() diff --git a/R/tmap_mode.R b/R/tmap_mode.R index 51bcf4c2..6265f036 100644 --- a/R/tmap_mode.R +++ b/R/tmap_mode.R @@ -1,11 +1,11 @@ #' Set tmap mode to static plotting or interactive viewing #' -#' Set tmap mode to static plotting or interactive viewing. The global option `tmap.mode` determines the whether thematic maps are plot in the graphics device, or shown as an interactive leaflet map (see also [tmap_options()]. The function `tmap_mode` is a wrapper to set this global option. The convenient function `ttm`, which stands for toggle thematic map, is a toggle switch between the two modes. The function `ttmp` stands for toggle thematic map and print last map: it does the same as `ttm` followed by `tmap_last`; in order words, it shows the last map in the other mode. It is recommended to use `tmap_mode` in scripts and `ttm`/`ttmp` in the console. +#' Set tmap mode to static plotting or interactive viewing. The global option `tmap.mode` determines the whether thematic maps are plot in the graphics device, or shown as an interactive leaflet map (see also [tmap_options()]. The function `tmap_mode` is a wrapper to set this global option. The convenient function `ttm`, which stands for toggle thematic map, is a toggle switch between the two modes. The function `ttmp` stands for toggle thematic map and print last map: it does the same as `ttm` followed by [tmap_last()]; in order words, it shows the last map in the other mode. It is recommended to use `tmap_mode()` in scripts and `ttm`/`ttmp` in the console. #' #' @param mode One of: #' \describe{ #' \item{`"plot"`}{Thematic maps are shown in the graphics device. This is the default mode, and supports all tmap's features, such as small multiples (see [tm_facets()]) and extensive layout settings (see [tm_layout()]). It is recommended for saving static maps (see [tmap_save()]).} -#' \item{`"view"`}{Thematic maps are viewed interactively in the web browser or RStudio's Viewer pane. Maps are fully interactive with tiles from OpenStreetMap or other map providers (see [tm_tiles()]). See also [tm_view()] for options related to the `"view"` mode. This mode generates a [leaflet::leaflet()] widget, which can also be directly obtained with [tmap_leaflet()]. With RMarkdown, it is possible to publish it to an HTML page. +#' \item{`"view"`}{Thematic maps are viewed interactively in the web browser or RStudio's Viewer pane. Maps are fully interactive with tiles from OpenStreetMap or other map providers (see [tm_tiles()]). See also [tm_view()] for options related to the `"view"` mode. This mode generates a [leaflet::leaflet()] widget, which can also be directly obtained with [tmap_leaflet()]. With R Markdown, it is possible to publish it to an HTML page. #' There are a couple of constraints in comparison to `"plot"`: #' \itemize{ #' \item The map is always projected according to the Web Mercator projection. Although this projection is the de facto standard for interactive web-based mapping, it lacks the equal-area property, which is important for many thematic maps, especially choropleths (see examples from [tm_shape()]). diff --git a/R/tmap_options.R b/R/tmap_options.R index 0eb72108..c5e8938a 100644 --- a/R/tmap_options.R +++ b/R/tmap_options.R @@ -710,34 +710,33 @@ complete_options = function(x, o) { #' #' @param ... See details #' @details -#' | option | description | -#' | ------ | ----------- | -#' | modes | Mode specific options. It is a named list where names correspond to the available modes. Each item is a list of options. | -#' | crs | Map crs (see [tm_shape()]). `NA` means the crs is specified in [tm_shape()]. The crs that is used by the transformation functions is defined in [tm_shape()].| +#' | option | description | +#' | ------ | ----------- | +#' | modes | Mode specific options. It is a named list where names correspond to the available modes. Each item is a list of options. | +#' | crs | Map crs (see [tm_shape()]). `NA` means the crs is specified in [tm_shape()]. The crs that is used by the transformation functions is defined in [tm_shape()].| #' | facet.max | Maximum number of facets | #' | facet.flip | Should facets be flipped (in case of facet wrap)? This can also be set via [tm_facets_flip()] | -#' | raster.max.cells | Maximum number of raster grid cells | -#' | show.messages | Show messages? | -#' | show.warnings | Show warnings? | -#' | output.format | Output format | -#' | output.size | Output size | +#' | raster.max.cells | Maximum number of raster grid cells | +#' | show.messages | Show messages? | +#' | show.warnings | Show warnings? | +#' | output.format | Output format | +#' | output.size | Output size | #' | output.dpi | Output dpi | #' | output.dpi.animation | Output dpi for animations | -#' | value.const | Default visual value constants e.g. the default fill color for `tm_shape(World) + tm_polygons()`. A list is required with per visual variable a value. | +#' | value.const | Default visual value constants e.g. the default fill color for `tm_shape(World) + tm_polygons()`. A list is required with per visual variable a value. | #' | value.na | Default visual values that are used to visualize NA data values. A list is required with per visual variable a value.| #' | value.null | Default visual values that are used to visualize null (out-of-scope) data values. A list is required with per visual variable a value.| -#' | value.blank | Default visual values that correspond to blank. For color these are `"#00000000"` meaning transparent. A list is required with per visual variable a value. | +#' | value.blank | Default visual values that correspond to blank. For color these are `"#00000000"` meaning transparent. A list is required with per visual variable a value. | #' | values.var | Default values when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. | -#' | values.range | Default range for values. See `values.range` of [tm_scale_categorical()]. A list is required with per visual variable a value. -#' | value.neutral | Default values for when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. | | +#' | values.range | Default range for values. See `values.range` of [tm_scale_categorical()]. A list is required with per visual variable a value. +#' | value.neutral | Default values for when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. | | #' | scales.var | Default scales. | -#' | label.format | Format for the labels (was legend.format in tmap v3) | +#' | label.format | Format for the labels (was `legend.format` in tmap v3) | #' | label.na | Default label for missing values | #' See [tm_layout()] for layout specific options #' @name tmap_options #' @rdname tmap_options #' @export -#' @md tmap_options = function(...) { o = get("tmapOptions", envir = .TMAP) nms = names(o) @@ -1099,7 +1098,7 @@ get_vector_id = function(x, id) { #' Internal tmap function to add a default value for the layer functions #' #' @param option, one of: `"value.const"`, `"value.na"`, `"value.blank"`, `"values.var"`, `'values.range'`, `"value.neutral"`, `"scales.var"` -#' @param id name of the visual variable with layer, in the format `"x.y"`, where x is the visual variable and y is the layer. It is also possible to set x only; then it applies to all layer functions. +#' @param id name of the visual variable with layer, in the format `"x.y"`, where `x` is the visual variable and `y` is the layer. It is also possible to set `x` only; then it applies to all layer functions. #' @param value value #' @keywords internal #' @export @@ -1141,7 +1140,7 @@ tmap_options_reset <- function() { } #' @export -#' @param style style, see `tmap_style()` for available styles +#' @param style style, see [tmap_style()] for available styles #' @rdname tmap_options tmap_options_save <- function(style) { show.messages <- get("tmapOptions", envir = .TMAP)$show.messages diff --git a/R/tmap_save.R b/R/tmap_save.R index a19c61a9..bb5ba369 100644 --- a/R/tmap_save.R +++ b/R/tmap_save.R @@ -4,20 +4,20 @@ #' #' @param tm tmap object #' @param filename filename including extension, and optionally the path. The extensions pdf, eps, svg, wmf (Windows only), png, jpg, bmp, tiff, and html are supported. If the extension is missing, the file will be saved as a static plot in `"plot"` mode and as an interactive map (html) in `"view"` mode (see details). The default format for static plots is png, but this can be changed using the option `"output.format"` in [tmap_options()]. If `NA` (the default), the file is saved as "tmap01" in the default format, and the number incremented if the file already exists. -#' @param device graphic device to use. Either a device function (e.g., [grDevices::png()] or [grDevices::cairo_pdf()]) or a text indicating selected graphic device: "pdf", "eps", "svg", "wmf" (Windows only), "png", "jpg", "bmp", "tiff". If NULL, the graphic device is guessed based on the `filename` argument. -#' @param height,width The width and height of the plot (not applicable for html files). Units are set with the argument `units`. If one of them is not specified, this is calculated using the formula asp = width / height, where asp is the estimated aspect ratio of the map. If both are missing, they are set such that width * height is equal to the option `"output.size"` in [tmap_options()]. This is by default 49, meaning that is the map is a square (so aspect ratio of 1) both width and height are set to 7. +#' @param device graphic device to use. Either a device function (e.g., [`png`][grDevices::png()] or [`cairo_pdf`][grDevices::cairo_pdf()]) or a text indicating selected graphic device: "pdf", "eps", "svg", "wmf" (Windows only), "png", "jpg", "bmp", "tiff". If NULL, the graphic device is guessed based on the `filename` argument. +#' @param height,width The width and height of the plot (not applicable for html files). Units are set with the argument `units`. If one of them is not specified, this is calculated using the formula asp = width / height, where asp is the estimated aspect ratio of the map. If both are missing, they are set such that `width * height` is equal to the option `"output.size"` in [tmap_options()]. This is by default 49, meaning that is the map is a square (so aspect ratio of 1) both width and height are set to 7. #' @param units units for width and height (`"in"`, `"cm"`, or `"mm"`). By default, pixels (`"px"`) are used if either width or height is set to a value greater than 50. Else, the units are inches (`"in"`) #' @param dpi dots per inch. Only applicable for raster graphics. By default it is set to 300, but this can be changed using the option `"output.dpi"` in [tmap_options()]. #' @param outer.margins overrides the outer.margins argument of [tm_layout()] (unless set to `NA`) #' @param asp if specified, it overrides the asp argument of [tm_layout()]. Tip: set to `0` if map frame should be placed on the edges of the image. #' @param scale overrides the scale argument of [tm_layout()] (unless set to `NA`) #' @param insets_tm tmap object of an inset map, or a list of tmap objects of multiple inset maps. The number of tmap objects should be equal to the number of viewports specified with `insets_vp`. -#' @param insets_vp [grid::viewport()] of an inset map, or a list of [grid::viewport()]s of multiple inset maps. The number of viewports should be equal to the number of tmap objects specified with `insets_tm`. -#' @param add.titles add titles to leaflet object -#' @param in.iframe should an interactive map be saved as an iframe? If so, two HTML files will be saved; one small parent HTML file with the iframe container, and one large child HTML file with the actual widget. See [widgetframe::saveWidgetframe()] for details. By default `FALSE` which means that one large HTML file is saved (see [htmlwidgets::saveWidget()]). +#' @param insets_vp [`viewport`][grid::viewport()] of an inset map, or a list of [`viewport`][grid::viewport()]s of multiple inset maps. The number of viewports should be equal to the number of tmap objects specified with `insets_tm`. +#' @param add.titles add titles to leaflet object. +#' @param in.iframe should an interactive map be saved as an iframe? If so, two HTML files will be saved; one small parent HTML file with the iframe container, and one large child HTML file with the actual widget. See [widgetframe::saveWidgetframe()] for details. By default `FALSE` which means that one large HTML file is saved (see [saveWidget()][htmlwidgets::saveWidget()]). #' @param selfcontained when an interactive map is saved, should the resources (e.g. Javascript libraries) be contained in the HTML file? If `FALSE`, they are placed in an adjacent directory (see also [htmlwidgets::saveWidget()]). Note that the HTML file will often still be large when `selfcontained = FALSE`, since the map data (polygons and popups), which are also contained in the HTML file, usually take more space then the map resources. #' @param verbose Deprecated. It is now controlled by the tmap option `show.messages` (see [tmap_options()]) -#' @param ... arguments passed on to device functions or to [htmlwidgets::saveWidget()] or [widgetframe::saveWidgetframe()] +#' @param ... arguments passed on to device functions or to [`saveWidget()`][htmlwidgets::saveWidget()] or [`saveWidgetFrame()`][widgetframe::saveWidgetframe()] #' @importFrom htmlwidgets saveWidget #' @import tmaptools #' @example ./examples/tmap_save.R diff --git a/R/tmap_style.R b/R/tmap_style.R index 4584d389..aa9d4371 100644 --- a/R/tmap_style.R +++ b/R/tmap_style.R @@ -2,13 +2,13 @@ #' #' Set or get the default tmap style. Without arguments, the current style is returned. Also the available styles are displayed. When a style is set, the corresponding tmap options (see [tmap_options()]) will be set accordingly. The default style (i.e. when loading the package) is `"white"`. #' -#' Note that [tm_style()] is used within a plot call (so it only affects that plot), whereas `tmap_style` sets the style globally. +#' Note that [tm_style()] is used within a plot call (so it only affects that plot), whereas `tmap_style()` sets the style globally. #' #' After loading a style, the options that defined this style (i.e. the difference with the default `"white"` style) can be obtained by [tmap_options_diff()]. #' #' The documentation of [tmap_options()] (details and the examples) shows how a new style is created. #' -#' @param style Name of the style. When omitted, `tmap_style` returns the current style and also shows all available styles. When the style is specified, `tmap_style` sets the style accordingly. Note that in that case, all tmap options (see [tmap_options()]) will be reset according to the style definition. See [tm_layout()] for predefined styles, and `tmap_style_catalogue` (not migrated to v4 yet) for creating a catalogue. +#' @param style Name of the style. When omitted, `tmap_style()` returns the current style and also shows all available styles. When the style is specified, `tmap_style()` sets the style accordingly. Note that in that case, all tmap options (see [tmap_options()]) will be reset according to the style definition. See [tm_layout()] for predefined styles, and `tmap_style_catalogue` (not migrated to v4 yet) for creating a catalogue. #' @return The style before changing #' @seealso [tmap_options()] for tmap options, and `tmap_style_catalogue` (not migrated to v4 yet) to create a style catalogue of all available styles. #' @example ./examples/tmap_style.R diff --git a/man/Shapes.Rd b/man/Shapes.Rd index 6255c21c..4ce69209 100644 --- a/man/Shapes.Rd +++ b/man/Shapes.Rd @@ -21,7 +21,7 @@ data(NLD_prov) data(NLD_muni) } \description{ -Maps of the world and the Netherlands (province and municipality level), class \code{\link[sf:sf]{sf::sf()}} +Maps of the world and the Netherlands (province and municipality level), class \code{\link[sf:sf]{sf}} } \details{ The default projections for these maps are Eckhart IV (World) and Rijksdriehoekstelsel (Netherlands). See below. The projection can be changed temporarily for plotting purposes by using the projection argument of \code{\link[=tm_shape]{tm_shape()}}. diff --git a/man/land.Rd b/man/land.Rd index 20507aef..66945975 100644 --- a/man/land.Rd +++ b/man/land.Rd @@ -8,7 +8,7 @@ data(land) } \description{ -Spatial data of global land cover, percent tree cover, and elevation of class \code{\link[stars:st_as_stars]{stars()}}. +Spatial data of global land cover, percent tree cover, and elevation of class \code{\link[stars:st_as_stars]{stars}}. Two attributes in this object relates to global land cover. The cover layer classifies the status of land cover of the whole globe into 20 categories, while the cover_cls layer uses 8 simplified categories. diff --git a/man/metro.Rd b/man/metro.Rd index 40a3bea4..d20e86e2 100644 --- a/man/metro.Rd +++ b/man/metro.Rd @@ -11,7 +11,7 @@ data(metro) } \description{ -Spatial data of metropolitan areas, of class \code{\link[sf:sf]{sf::sf()}}. The data includes a population times series from 1950 to (forecasted) 2030. All metro areas with over 1 million inhabitants in 2010 are included. +Spatial data of metropolitan areas, of class \code{\link[sf:sf]{sf}}. The data includes a population times series from 1950 to (forecasted) 2030. All metro areas with over 1 million inhabitants in 2010 are included. } \references{ United Nations, Department of Economic and Social Affairs, Population Division (2014). World Urbanization Prospects: The 2014 Revision, CD-ROM Edition. diff --git a/man/qtm.Rd b/man/qtm.Rd index 7a636d4f..11e14a07 100644 --- a/man/qtm.Rd +++ b/man/qtm.Rd @@ -32,7 +32,7 @@ qtm( \arguments{ \item{shp}{One of \itemize{ -\item shape object, which is an object from a class defined by the \code{\link[sf:sf]{sf::sf()}} or \code{\link[stars:st_as_stars]{stars()}} package. Objects from the packages \code{sp} and \code{raster} are also supported, but discouraged. +\item shape object, which is an object from a class defined by the \code{\link[sf:sf]{sf}} or \code{\link[stars:st_as_stars]{stars}} package. Objects from the packages \code{sp} and \code{raster} are also supported, but discouraged. \item Not specified, i.e. \code{qtm()} is executed. In this case a plain interactive map is shown. \item A OSM search string, e.g. \code{qtm("Amsterdam")}. In this case a plain interactive map is shown positioned according to the results of the search query (from OpenStreetMap nominatim) }} @@ -45,7 +45,7 @@ qtm( \item{title}{main title. For legend titles, use \code{X.style}, where X is the layer name (see \code{...}).} -\item{crs}{Either a \code{\link[sf:st_crs]{crs()}} object or a character value (\code{PROJ.4} character string). By default, the projection is used that is defined in the \code{shp} object itself.} +\item{crs}{Either a \code{\link[sf:st_crs]{crs}} object or a character value (\code{PROJ.4} character string). By default, the projection is used that is defined in the \code{shp} object itself.} \item{bbox}{bounding box. Arugment passed on to \code{\link[=tm_shape]{tm_shape()}}} diff --git a/man/rivers.Rd b/man/rivers.Rd index 18b69fa3..72c3f2fc 100644 --- a/man/rivers.Rd +++ b/man/rivers.Rd @@ -11,5 +11,5 @@ data(rivers) } \description{ -Spatial data of rivers, of class \code{\link[sf:sf]{sf::sf()}} +Spatial data of rivers, of class \code{\link[sf:sf]{sf}} } diff --git a/man/tm_basemap.Rd b/man/tm_basemap.Rd index e3ce8373..0fbea8ba 100644 --- a/man/tm_basemap.Rd +++ b/man/tm_basemap.Rd @@ -24,7 +24,7 @@ tm_tiles( ) } \arguments{ -\item{server}{Name of the provider or an URL. The list of available providers can be obtained with \code{providers} (tip: in RStudio, type \verb{providers$} to see the options). See \url{https://leaflet-extras.github.io/leaflet-providers/preview/} for a preview of those. When a URL is provided, it should be in template format, e.g. \code{"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}. Use \code{NULL} in \code{tm_basemap} to disable basemaps.} +\item{server}{Name of the provider or an URL. The list of available providers can be obtained with \code{providers} (tip: in RStudio, type \verb{providers$} to see the options). See \url{https://leaflet-extras.github.io/leaflet-providers/preview/} for a preview of those. When a URL is provided, it should be in template format, e.g. \code{"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}. Use \code{NULL} in \code{tm_basemap()} to disable basemaps.} \item{alpha}{Transparency level} @@ -37,7 +37,7 @@ tm_tiles( \item{group.control}{In view mode, the group control determines how layer groups can be switched on and off. Options: \code{"radio"} for radio buttons (meaning only one group can be shown), \code{"check"} for check boxes (so multiple groups can be shown), and \code{"none"} for no control (the group cannot be (de)selected).} } \description{ -Map layer that draws tiles from a tile server. The function \code{tm_basemap} draws the tile layer as basemap, i.e. as bottom layer. In contrast, \code{tm_tiles} draws the tile layer as overlay layer, where the stacking order corresponds with the order in which this layer is called, just like other map layers. +Map layer that draws tiles from a tile server. \code{tm_basemap()} draws the tile layer as basemap, i.e. as bottom layer. In contrast, \code{tm_tiles()} draws the tile layer as overlay layer, where the stacking order corresponds with the order in which this layer is called, just like other map layers. } \examples{ tm_basemap() + diff --git a/man/tm_facets.Rd b/man/tm_facets.Rd index aab54af3..382ec1b1 100644 --- a/man/tm_facets.Rd +++ b/man/tm_facets.Rd @@ -77,7 +77,7 @@ tm_facets_flip() \item{sync}{Logical. Should the navigation in view mode (zooming and panning) be synchronized? By default \code{TRUE} if the facets have the same bounding box. This is generally the case when rasters are plotted, or when free.coords is \code{FALSE}.} -\item{showNA}{If the \code{by} argument is specified, should missing values of the \code{by}-variable be shown in a facet? If two \code{by}-variables are specified, should missing values be shown in an additional row and column? If \code{NA}, missing values only are shown if they exist. Similar to the \code{useNA} argument of \code{\link[base:table]{base::table()}}, where \code{TRUE}, \code{FALSE}, and \code{NA} correspond to \code{"always"}, \code{"no"}, and \code{"ifany"} respectively.} +\item{showNA}{If the \code{by} argument is specified, should missing values of the \code{by}-variable be shown in a facet? If two \code{by}-variables are specified, should missing values be shown in an additional row and column? If \code{NA}, missing values only are shown if they exist. Similar to the \code{useNA} argument of \link[base:table]{table()}, where \code{TRUE}, \code{FALSE}, and \code{NA} correspond to \code{"always"}, \code{"no"}, and \code{"ifany"} respectively.} \item{textNA}{Text used for facets of missing values.} @@ -85,10 +85,10 @@ tm_facets_flip() \item{type}{\code{"grid"}, \code{"wrap"} or \code{"stack"}} -\item{along}{deceprated Please use \code{tm_facets_page}} +\item{along}{deceprated Please use \code{tm_facets_page()}} -\item{...}{paseed on to \code{tm_facets}} +\item{...}{paseed on to \code{tm_facets()}} } \description{ -Specify facets. \code{tm_facets} is the core function, but recommended is to use \code{tm_facets_wrap}, \code{tm_facets_stack} or \code{tm_facets_grid}. The former two specify facets for one grouping variable (so one faceting dimension). The difference is that wrap may place facets in multiple rows and columns whereas \code{tm_facets_stack} stacks the facets either horizontally or vertically. \code{tm_facets_grid} supports up to three faceting dimensions. +Specify facets. \code{tm_facets()} is the core function, but recommended is to use \code{tm_facets_wrap()}, \code{tm_facets_stack()} or \code{tm_facets_grid()}. The former two specify facets for one grouping variable (so one faceting dimension). The difference is that wrap may place facets in multiple rows and columns whereas \code{tm_facets_stack()} stacks the facets either horizontally or vertically. \code{tm_facets_grid()} supports up to three faceting dimensions. } diff --git a/man/tm_grid.Rd b/man/tm_grid.Rd index 8a093764..af06148f 100644 --- a/man/tm_grid.Rd +++ b/man/tm_grid.Rd @@ -63,7 +63,7 @@ tm_grid( \item{scientific}{Should the labels be formatted scientifically? If so, square brackets are used, and the \code{format} of the numbers is \code{"g"}. Otherwise, \code{format="f"}, and \code{text.separator}, \code{text.less.than}, and \code{text.or.more} are used. Also, the numbers are automatically rounded to millions or billions if applicable.} \item{format}{By default, \code{"f"}, i.e. the standard notation \code{xxx.xxx}, is used. If \code{scientific=TRUE} then \code{"g"}, which means that numbers are formatted scientifically, i.e. \code{n.dddE+nn} if needed to save space.} \item{digits}{Number of digits after the decimal point if \code{format="f"}, and the number of significant digits otherwise.} -\item{...}{Other arguments passed on to \code{\link[base:formatc]{base::formatC()}}} +\item{...}{Other arguments passed on to \code{\link[=formatC]{formatC()}}} }} \item{labels.cardinal}{Add the four cardinal directions (N, E, S, W) to the labels, instead of using negative coordinates for west and south (so it assumes that the coordinates are positive in the north-east direction).} @@ -109,7 +109,7 @@ tm_grid( \item{group.control}{In view mode, the group control determines how layer groups can be switched on and off. Options: \code{"radio"} for radio buttons (meaning only one group can be shown), \code{"check"} for check boxes (so multiple groups can be shown), and \code{"none"} for no control (the group cannot be (de)selected).} } \description{ -Creates a \code{\link[=tmap-element]{tmap-element()}} that draws coordinate grid lines. It serves as a layer that can be drawn anywhere between other layers. By default, \code{tm_grid} draws horizontal and vertical lines acording to the coordinate system of the (master) shape object. Latitude and longitude graticules are drawn with \code{tm_graticules}. +Creates a \code{\link{tmap-element}} that draws coordinate grid lines. It serves as a layer that can be drawn anywhere between other layers. By default, \code{tm_grid()} draws horizontal and vertical lines acording to the coordinate system of the (master) shape object. Latitude and longitude graticules are drawn with \code{tm_graticules()}. } \examples{ current.mode <- tmap_mode("plot") diff --git a/man/tm_lines.Rd b/man/tm_lines.Rd index 2368d28e..b65601ca 100644 --- a/man/tm_lines.Rd +++ b/man/tm_lines.Rd @@ -45,7 +45,7 @@ tm_lines( \item{col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free}{Visual variable that determines the border color alpha transparency. See details.} -\item{linejoin, lineend}{line join and line end. See \code{\link[grid:gpar]{grid::gpar()}} for details.} +\item{linejoin, lineend}{line join and line end. See \link[grid:gpar]{gpar()} for details.} \item{plot.order}{Specification in which order the spatial features are drawn. See \code{\link[=tm_plot_order]{tm_plot_order()}} for details.} diff --git a/man/tm_plot.Rd b/man/tm_plot.Rd index 9626e567..300ec348 100644 --- a/man/tm_plot.Rd +++ b/man/tm_plot.Rd @@ -7,7 +7,7 @@ tm_plot(use.gradient) } \arguments{ -\item{use.gradient}{Use gradient fill using \code{\link[grid:patterns]{grid::linearGradient()}}} +\item{use.gradient}{Use gradient fill using \link[grid:patterns]{linearGradient()}} } \description{ Plot mode options. This option is specific to the plot mode. diff --git a/man/tm_polygons.Rd b/man/tm_polygons.Rd index 802cb078..400dbe30 100644 --- a/man/tm_polygons.Rd +++ b/man/tm_polygons.Rd @@ -63,7 +63,7 @@ tm_borders(col = tm_const(), ...) \item{col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free}{Visual variable that determines the border color alpha transparency. See details.} -\item{linejoin, lineend}{Line join and line end. See \code{\link[grid:gpar]{grid::gpar()}} for details.} +\item{linejoin, lineend}{Line join and line end. See \link[grid:gpar]{gpar()} for details.} \item{plot.order}{Specification in which order the spatial features are drawn. See \code{\link[=tm_plot_order]{tm_plot_order()}} for details.} diff --git a/man/tm_pos.Rd b/man/tm_pos.Rd index 6210badf..4f250a25 100644 --- a/man/tm_pos.Rd +++ b/man/tm_pos.Rd @@ -28,24 +28,24 @@ tm_pos_auto_in(align.h, align.v, just.h, just.v) \item{just.h, just.v}{The justification of the components. Only used in case \code{pos.h} and \code{pos.v} are numbers.} } \description{ -Set the position of map components, such as legends, title, compass, scale bar, etc. \code{tm_pos} is the function to position these components: \code{tm_pos_out} places the components outside the map area and \code{tm_pos_in} inside the map area. Each \code{position} argument of a map layer or component should be specified with one of these functions. The functions \code{tm_pos_auto_out} and \code{tm_pos_auto_in} are used to set the components automatically, and are recommended to use globally, via \code{\link[=tmap_options]{tmap_options()}}. See details how the positioning works. +Set the position of map components, such as legends, title, compass, scale bar, etc. \code{tm_pos()} is the function to position these components: \code{tm_pos_out()} places the components outside the map area and \code{tm_pos_in()} inside the map area. Each \code{position} argument of a map layer or component should be specified with one of these functions. The functions \code{tm_pos_auto_out()} and \code{tm_pos_auto_in()} are used to set the components automatically, and are recommended to use globally, via \code{\link[=tmap_options]{tmap_options()}}. See Details how the positioning works. } \details{ \tabular{rllll}{ \tab \tab \tab \tab \cr \tab +------------------- \tab +-------------------------------- \tab +------------------- \tab + \cr \tab | \tab | \tab | \tab | \cr - "top" \tab | \tab | \tab | \tab | \cr + \code{"top"} \tab | \tab | \tab | \tab | \cr \tab | \tab | \tab | \tab | \cr \tab +------------------- \tab +-------------------------------- \tab +------------------- \tab + \cr \tab | \tab | \tab | \tab | \cr \tab | \tab | \tab | \tab | \cr - cell.v  "center" \tab | \tab |   Map(s) \tab | \tab | \cr + \code{cell.v}  "center" \tab | \tab |   Map(s) \tab | \tab | \cr \tab | \tab | \tab | \tab | \cr \tab | \tab | \tab | \tab | \cr \tab +------------------- \tab +-------------------------------- \tab +------------------- \tab + \cr \tab | \tab | \tab | \tab | \cr - "bottom" \tab | \tab | \tab | \tab | \cr + \code{"bottom"} \tab | \tab | \tab | \tab | \cr \tab | \tab | \tab | \tab | \cr \tab +------------------- \tab +-------------------------------- \tab +------------------- \tab + \cr \tab   \code{"left"} \tab   \code{"center"} \tab    \code{"right"} \tab \cr @@ -53,17 +53,17 @@ Set the position of map components, such as legends, title, compass, scale bar, } -\code{tm_pos_in} sets the position of the component(s) inside the maps area, which is equivalent to the center-center cell (in case there are facets, these are all drawn in this center-center cell). +\code{tm_pos_in()} sets the position of the component(s) inside the maps area, which is equivalent to the center-center cell (in case there are facets, these are all drawn in this center-center cell). -\code{tm_pos_out} sets the position of the component(s) outside the map. +\code{tm_pos_out()} sets the position of the component(s) outside the map. The amount of space that the top and bottom rows, and left and right columns occupy is determined by the \code{\link[=tm_layout]{tm_layout()}} arguments \code{meta.margins} and \code{meta.auto.margins}. The former sets the relative space of the bottom, left, top, and right side. In case these are set to \code{NA}, the space is set automatically based on 1) the maximum relative space specified by \code{meta.auto.margins} and 2) the presence and size of components in each cell. For instance, if there is one landscape oriented legend in the center-bottom cell, then the relative space of the bottom row is set to the height of that legend (given that it is smaller than the corresponding value of \code{meta.auto.margins}), while the other four sides are set to 0. -\code{tm_pos_auto_out} is more complex: the \code{cell.h} and \code{cell.v} arguments of should be set to one of the four corners. It does not mean that the components are drawn in a corner. The corner represents the sides of the map that the components are drawn. By default, legends are drawn either at the bottom or on the right-side of the map by default (see \code{tmap_options("legend.position")}). Only when there are row- and column-wise legends and a general legend (using \code{\link[=tm_facets_grid]{tm_facets_grid()}}), the general legend is drawn in the corner, but in practice this case will be rare. +\code{tm_pos_auto_out()} is more complex: the \code{cell.h} and \code{cell.v} arguments of should be set to one of the four corners. It does not mean that the components are drawn in a corner. The corner represents the sides of the map that the components are drawn. By default, legends are drawn either at the bottom or on the right-side of the map by default (see \code{tmap_options("legend.position")}). Only when there are row- and column-wise legends and a general legend (using \code{\link[=tm_facets_grid]{tm_facets_grid()}}), the general legend is drawn in the corner, but in practice this case will be rare. The arguments \code{pos.h} and \code{pos.v} determine where the components are drawn within the cell. Again, with \code{"left"}, \code{"center"}, and \code{"right"} for \code{pos.h} and \code{"top"}, \code{"center"}, and \code{"bottom"} for \code{pos.v}. The values can also be specified in upper-case, which influences the offset with the cell borders, which is determined by tmap option \code{component.offset}. By default, there is a small offset when components are drawn inside and no offset when they are drawn outside or with upper-case. -\code{tm_pos_auto_in} automatically determines \code{pos.h} and \code{pos.v} given the available space inside the map. This is similar to the default positioning in tmap3. +\code{tm_pos_auto_in()} automatically determines \code{pos.h} and \code{pos.v} given the available space inside the map. This is similar to the default positioning in tmap3. In case multiple components are draw in the same cell and the same position inside that cell, they are stacked (determined which the \code{stack} argument in the legend or component function). The \code{align.h} and \code{align.v} arguments determine how these components will be justified with each other. diff --git a/man/tm_scale.Rd b/man/tm_scale.Rd index 5db7c9d6..96b8baa6 100644 --- a/man/tm_scale.Rd +++ b/man/tm_scale.Rd @@ -7,8 +7,8 @@ tm_scale(...) } \arguments{ -\item{...}{arguments passed on to the applied scale function \code{tm_scale_}} +\item{...}{arguments passed on to the applied scale function \verb{tm_scale_*()}} } \description{ -Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale} is an scale that is set automatically given by the data type (factor, numeric, and integer) and the visual variable. The tmap option \code{scales.var} contains information which scale is applied when. +Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale()} is a scale that is set automatically given by the data type (factor, numeric, and integer) and the visual variable. The tmap option \code{scales.var} contains information which scale is applied when. } diff --git a/man/tm_scale_bivariate.Rd b/man/tm_scale_bivariate.Rd index c434d02e..18a982f7 100644 --- a/man/tm_scale_bivariate.Rd +++ b/man/tm_scale_bivariate.Rd @@ -20,9 +20,9 @@ tm_scale_bivariate( ) } \arguments{ -\item{scale1, scale2}{two \code{tm_scale} objects. Currently, all \code{tm_scale_} functions are supported except \code{tm_scale_continous}.} +\item{scale1, scale2}{two \code{tm_scale} objects. Currently, all \code{tm_scale_} functions are supported except \code{tm_scale_continous()}.} -\item{values}{(generic scale argument) The visual values. For colors (e.g. \code{fill} or \code{col} for \code{tm_polygons}) this is a palette name from the \code{cols4all} package (see \code{\link[cols4all:c4a]{cols4all::c4a()}}) or vector of colors, for size (e.g. \code{size} for \code{tm_symbols}) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. \code{shape} for \code{\link[=tm_symbols]{tm_symbols()}}) these are a set of symbols, etc. The tmap option \code{values.var} contains the default values per visual variable and in some cases also per data type.} +\item{values}{(generic scale argument) The visual values. For colors (e.g. \code{fill} or \code{col} for \code{tm_polygons()}) this is a palette name from the \code{cols4all} package (see \code{\link[cols4all:c4a]{cols4all::c4a()}}) or vector of colors, for size (e.g. \code{size} for \code{tm_symbols()}) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. \code{shape} for \code{\link[=tm_symbols]{tm_symbols()}}) these are a set of symbols, etc. The tmap option \code{values.var} contains the default values per visual variable and in some cases also per data type.} \item{values.repeat}{(generic scale argument) Should the values be repeated in case there are more categories?} @@ -43,5 +43,5 @@ tm_scale_bivariate( \item{label.null}{(generic scale argument) Label for null (out-of-scope) values} } \description{ -Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale_bivariat} is usedf or bivariate.scales +Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale_bivariate()} is used or \code{bivariate.scales}. } diff --git a/man/tm_scale_categorical.Rd b/man/tm_scale_categorical.Rd index 977354a6..4ab734ae 100644 --- a/man/tm_scale_categorical.Rd +++ b/man/tm_scale_categorical.Rd @@ -42,7 +42,7 @@ tm_scale_categorical( \arguments{ \item{n.max}{Maximum number of categories (factor levels). In case there are more, they are grouped into \code{n.max} groups.} -\item{values}{(generic scale argument) The visual values. For colors (e.g. \code{fill} or \code{col} for \code{tm_polygons}) this is a palette name from the \code{cols4all} package (see \code{\link[cols4all:c4a]{cols4all::c4a()}}) or vector of colors, for size (e.g. \code{size} for \code{tm_symbols}) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. \code{shape} for \code{\link[=tm_symbols]{tm_symbols()}}) these are a set of symbols, etc. The tmap option \code{values.var} contains the default values per visual variable and in some cases also per data type.} +\item{values}{(generic scale argument) The visual values. For colors (e.g. \code{fill} or \code{col} for \code{tm_polygons()}) this is a palette name from the \code{cols4all} package (see \code{\link[cols4all:c4a]{cols4all::c4a()}}) or vector of colors, for size (e.g. \code{size} for \code{tm_symbols()}) these are a set of sizes (if two values are specified they are interpret as range), for symbol shapes (e.g. \code{shape} for \code{\link[=tm_symbols]{tm_symbols()}}) these are a set of symbols, etc. The tmap option \code{values.var} contains the default values per visual variable and in some cases also per data type.} \item{values.repeat}{(generic scale argument) Should the values be repeated in case there are more categories?} @@ -66,8 +66,8 @@ tm_scale_categorical( \item{label.null}{(generic scale argument) Label for null (out-of-scope) values} -\item{label.format}{(generic scale argument) Label formatting (similar to legend.format in tmap3)} +\item{label.format}{(generic scale argument) Label formatting (similar to \code{legend.format} in tmap3)} } \description{ -Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The functions \code{tm_scale_categorical} and \code{tm_scale_ordinal} are used for categorical data. The only difference between these functions is that the former assumes unordered categories whereas the latter assumes ordered categories. For colors (the visual variable \code{fill} or \code{col}), different default color palettes are used (see the tmap option \code{values.var}). +Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The functions \code{tm_scale_categorical()} and \code{tm_scale_ordinal()} are used for categorical data. The only difference between these functions is that the former assumes unordered categories whereas the latter assumes ordered categories. For colors (the visual variable \code{fill} or \code{col}), different default color palettes are used (see the tmap option \code{values.var}). } diff --git a/man/tm_scale_continuous.Rd b/man/tm_scale_continuous.Rd index 7d87b11e..cd9f71d2 100644 --- a/man/tm_scale_continuous.Rd +++ b/man/tm_scale_continuous.Rd @@ -63,7 +63,7 @@ tm_scale_continuous_log1p(...) \item{label.null}{(generic scale argument) Label for null (out-of-scope) values} -\item{label.format}{(generic scale argument) Label formatting (similar to legend.format in tmap3)} +\item{label.format}{(generic scale argument) Label formatting (similar to \code{legend.format} in tmap3)} \item{...}{passed on to \code{tm_scale_continuous}} } diff --git a/man/tm_scale_discrete.Rd b/man/tm_scale_discrete.Rd index 73abdf69..ef0495ef 100644 --- a/man/tm_scale_discrete.Rd +++ b/man/tm_scale_discrete.Rd @@ -45,8 +45,8 @@ tm_scale_discrete( \item{label.null}{(generic scale argument) Label for null (out-of-scope) values} -\item{label.format}{(generic scale argument) Label formatting (similar to legend.format in tmap3)} +\item{label.format}{(generic scale argument) Label formatting (similar to \code{legend.format} in tmap3)} } \description{ -Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale_discrete} is used for discrete numerical data, such as integers. +Scales in tmap are configured by the family of functions with prefix \code{tm_scale}. Such function should be used for the input of the \code{.scale} arguments in the layer functions (e.g. \code{fill.scale} in \code{\link[=tm_polygons]{tm_polygons()}}). The function \code{tm_scale_discrete()} is used for discrete numerical data, such as integers. } diff --git a/man/tm_scalebar.Rd b/man/tm_scalebar.Rd index 6b1de5bc..13696c0a 100644 --- a/man/tm_scalebar.Rd +++ b/man/tm_scalebar.Rd @@ -60,5 +60,5 @@ tm_scalebar( \item{z}{z} } \description{ -Map component that adds a scale bar. As of version 4.0, \code{tm_scalebar} is used instead of \code{tm_scale_bar} (now deprecated), because of the potential confusion with the \code{tm_scale_x} scaling functions (like \code{\link[=tm_scale_continuous]{tm_scale_continuous()}}). +Map component that adds a scale bar. As of version 4.0, \code{tm_scalebar()} is used instead of \code{tm_scale_bar} (now deprecated), because of the potential confusion with the \code{tm_scale_x} scaling functions (like \code{\link[=tm_scale_continuous]{tm_scale_continuous()}}). } diff --git a/man/tm_sf.Rd b/man/tm_sf.Rd index 2620db72..eca52283 100644 --- a/man/tm_sf.Rd +++ b/man/tm_sf.Rd @@ -69,7 +69,7 @@ tm_sf( \item{col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free}{Visual variable that determines the border color alpha transparency. See details.} -\item{linejoin, lineend}{line join and line end. See \code{\link[grid:gpar]{grid::gpar()}} for details.} +\item{linejoin, lineend}{line join and line end. See \link[grid:gpar]{gpar()} for details.} \item{plot.order.list}{Specification in which order the spatial features are drawn. This consists of a list of three elementary geometry types: for polygons, lines and, points. For each of these types, which are drawn in that order, a \code{\link[=tm_plot_order]{tm_plot_order()}} is required.} diff --git a/man/tm_shape.Rd b/man/tm_shape.Rd index c75e90d6..62ed52cc 100644 --- a/man/tm_shape.Rd +++ b/man/tm_shape.Rd @@ -33,5 +33,5 @@ tm_shape( \item{...}{to catch deprecated arguments from version < 4.0} } \description{ -Specify a shape, which is a spatial object from one of these spatial object class packages: \code{sf}, \code{stars}, \code{terra}. +Specify a shape, which is a spatial object from one of these spatial object class packages: \code{\link[sf:sf]{sf}}, \code{\link[stars:st_as_stars]{stars}}, \code{terra}. } diff --git a/man/tm_text.Rd b/man/tm_text.Rd index 8a5dfbe9..407fd789 100644 --- a/man/tm_text.Rd +++ b/man/tm_text.Rd @@ -43,11 +43,11 @@ tm_text( \item{col, col.scale, col.legend, col.free}{Visual variable that determines the col color. See details.} -\item{col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free}{Visual variable that determines the border color alpha transparency. See details.} +\item{col_alpha, col_alpha.scale, col_alpha.legend, col_alpha.free}{Visual variable that determines the border color alpha transparency. See Details.} -\item{fontface, fontface.scale, fontface.legend, fontface.free}{Visual variable that determines the font face. See details.} +\item{fontface, fontface.scale, fontface.legend, fontface.free}{Visual variable that determines the font face. See Details.} -\item{fontfamily}{The font family. See \code{\link[grid:gpar]{grid::gpar()}} for details.} +\item{fontfamily}{The font family. See \link[grid:gpar]{gpar()} for details.} \item{shadow}{Shadow behind the text. Logical or color.} @@ -73,7 +73,7 @@ The \code{.scale} arguments determine the used scale to map the data values to v The \code{.legend} arguments determine the used legend, specified with \code{\link[=tm_legend]{tm_legend()}}. The default legend and its settings are determined by the tmap options \code{legend.}. -The \code{.free} arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (see \code{\link[=tm_facets]{tm_facets()}}). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (\code{\link[=tm_facets_grid]{tm_facets_grid()}}). For instance, \code{col.free = c(TRUE, FALSE, FALSE)} means that for the visual variable \code{col}, each row of facets will have its own scale, and therefore its own legend. For facet wraps and stacks (\code{\link[=tm_facets_wrap]{tm_facets_wrap()}} and \code{\link[=tm_facets_stack]{tm_facets_stack()}}) there is only one facet dimension, so the \code{.free} argument requires only one logical value. +The \code{.free} arguments determine whether scales are applied freely across facets, or shared. A logical value is required. They can also be specified with a vector of three logical values; these determine whether scales are applied freely per facet dimension. This is only useful when facets are applied (see \code{\link[=tm_facets]{tm_facets()}}). There are maximally three facet dimensions: rows, columns, and pages. This only applies for a facet grid (\code{\link[=tm_facets_grid]{tm_facets_grid()}}). For instance, \code{col.free = c(TRUE, FALSE, FALSE)} means that for the visual variable \code{col}, each row of facets will has its own scale, and therefore its own legend. For facet wraps and stacks (\code{\link[=tm_facets_wrap]{tm_facets_wrap()}} and \code{\link[=tm_facets_stack]{tm_facets_stack()}}) there is only one facet dimension, so the \code{.free} argument requires only one logical value. } \examples{ data(rivers) diff --git a/man/tm_view.Rd b/man/tm_view.Rd index 3f0272e6..ee8bc9fe 100644 --- a/man/tm_view.Rd +++ b/man/tm_view.Rd @@ -24,13 +24,13 @@ tm_view( \item{control.overlays}{overlay layers} -\item{set.bounds}{logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to \code{\link[leaflet:map-methods]{leaflet::setMaxBounds()}}} +\item{set.bounds}{logical that determines whether maximum bounds are set, or a bounding box. Not applicable in plot mode. In view mode, this is passed on to \link[leaflet:map-methods]{setMaxBounds()}} -\item{set.view}{numeric vector that determines the view. Either a vector of three: lng, lat, and zoom, or a single value: zoom. See \code{\link[leaflet:map-methods]{leaflet::setView()}}. Only applicable if \code{bbox} is not specified} +\item{set.view}{numeric vector that determines the view. Either a vector of three: lng, lat, and zoom, or a single value: zoom. See \link[leaflet:map-methods]{setView()}. Only applicable if \code{bbox} is not specified} -\item{set.zoom.limits}{numeric vector of two that set the minimum and maximum zoom levels (see \code{\link[leaflet:map-options]{leaflet::tileOptions()}}).} +\item{set.zoom.limits}{numeric vector of two that set the minimum and maximum zoom levels (see \link[leaflet:map-options]{tileOptions()}).} -\item{leaflet.options}{options passed on to \code{\link[leaflet:leaflet]{leaflet::leafletOptions()}}} +\item{leaflet.options}{options passed on to \link[leaflet:leaflet]{leafletOptions()}} } \description{ View mode options. These options are specific to the view mode. diff --git a/man/tmap-package.Rd b/man/tmap-package.Rd index 5ed1a360..3aa74c65 100644 --- a/man/tmap-package.Rd +++ b/man/tmap-package.Rd @@ -111,12 +111,12 @@ Create icons: \section{Spatial datasets}{ \tabular{ll}{ -\code{\link[=World]{World()}}\tab World country data (\code{\link[sf:sf]{sf::sf()}} object of polygons) \cr -\code{\link[=NLD_prov]{NLD_prov()}}\tab Netherlands province data (\code{\link[sf:sf]{sf::sf()}} object of polygons) \cr -\code{\link[=NLD_muni]{NLD_muni()}}\tab Netherlands municipal data (\code{\link[sf:sf]{sf::sf()}} object of polygons) \cr -\code{\link[=metro]{metro()}}\tab Metropolitan areas (\code{\link[sf:sf]{sf::sf()}} object of points) \cr -\code{\link[=rivers]{rivers()}}\tab Rivers (\code{\link[sf:sf]{sf::sf()}} object of lines) \cr -\code{\link[=land]{land()}}\tab Global land cover (\code{\link[stars:st_as_stars]{stars()}} object)\cr +\code{\link[=World]{World()}}\tab World country data (\code{\link[sf:sf]{sf}} object of polygons) \cr +\code{\link[=NLD_prov]{NLD_prov()}}\tab Netherlands province data (\code{\link[sf:sf]{sf}} object of polygons) \cr +\code{\link[=NLD_muni]{NLD_muni()}}\tab Netherlands municipal data (\code{\link[sf:sf]{sf}} object of polygons) \cr +\code{\link[=metro]{metro()}}\tab Metropolitan areas (\code{\link[sf:sf]{sf}} object of points) \cr +\code{\link[=rivers]{rivers()}}\tab Rivers (\code{\link[sf:sf]{sf}} object of lines) \cr +\code{\link[=land]{land()}}\tab Global land cover (\code{\link[stars:st_as_stars]{stars}} object)\cr --------------------------- \tab --------------------------------------------------------------------------------------------------- \cr } } diff --git a/man/tmapAddLayerOptions.Rd b/man/tmapAddLayerOptions.Rd index d2da0c5e..7df3518b 100644 --- a/man/tmapAddLayerOptions.Rd +++ b/man/tmapAddLayerOptions.Rd @@ -9,7 +9,7 @@ tmapAddLayerOptions(option, id, value) \arguments{ \item{option, }{one of: \code{"value.const"}, \code{"value.na"}, \code{"value.blank"}, \code{"values.var"}, \code{'values.range'}, \code{"value.neutral"}, \code{"scales.var"}} -\item{id}{name of the visual variable with layer, in the format \code{"x.y"}, where x is the visual variable and y is the layer. It is also possible to set x only; then it applies to all layer functions.} +\item{id}{name of the visual variable with layer, in the format \code{"x.y"}, where \code{x} is the visual variable and \code{y} is the layer. It is also possible to set \code{x} only; then it applies to all layer functions.} \item{value}{value} } diff --git a/man/tmap_arrange.Rd b/man/tmap_arrange.Rd index 51f2713b..473ce0b3 100644 --- a/man/tmap_arrange.Rd +++ b/man/tmap_arrange.Rd @@ -22,7 +22,7 @@ knit_print.tmap_arrange(x, ..., options = NULL) \method{print}{tmap_arrange}(x, knit = FALSE, ..., options = NULL) } \arguments{ -\item{...}{\code{\link[=tmap]{tmap()}} objects or one list of \code{\link[=tmap]{tmap()}} objects. The number of multiples that can be plot is limited (see details).} +\item{...}{\code{\link{tmap}} objects or one list of \code{\link{tmap}} objects. The number of multiples that can be plot is limited (see details).} \item{ncol}{number of columns} @@ -38,9 +38,9 @@ knit_print.tmap_arrange(x, ..., options = NULL) \item{outer.margins}{outer.margins, numeric vector four or a single value. If defines the outer margins for each multiple. If will overwrite the \code{outer.margins} argument from \code{\link[=tm_layout]{tm_layout()}}, unless set to \code{NULL}.} -\item{x}{a \code{tmap_arrange} object (returned from \code{tmap_arrange})} +\item{x}{a \code{tmap_arrange} object (returned from \code{tmap_arrange()})} -\item{options}{options passed on to knitprint} +\item{options}{options passed on to \code{\link[knitr:knit_print]{knitr::knit_print()}}} \item{knit}{should \code{\link[knitr:knit_print]{knitr::knit_print()}} be enabled, or the normal \code{\link[base:print]{base::print()}} function?} } @@ -48,7 +48,7 @@ knit_print.tmap_arrange(x, ..., options = NULL) Arrange small multiples in a grid layout. Normally, small multiples are created by specifying multiple variables for one aesthetic or by specifying the by argument (see \code{\link[=tm_facets]{tm_facets()}}). This function can be used to arrange custom small multiples in a grid layout. } \details{ -The global option \code{tmap.limits} controls the limit of the number of facets that are plotted. By default, \code{tmap_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. +The global option \code{tmap.limits} controls the limit of the number of facets that are plotted. By default, \code{tmap_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{ tm1 = tm_shape(World) + tm_polygons("HPI") diff --git a/man/tmap_format.Rd b/man/tmap_format.Rd index 65fbb1fa..caed6731 100644 --- a/man/tmap_format.Rd +++ b/man/tmap_format.Rd @@ -20,7 +20,7 @@ tmap_format_add(..., name) The function \code{tmap_format()} returns the names of the available formats. When \code{format} is defined, it returns the option list corresponding the that format. } \description{ -Format options are tmap options that are shape dependent. With \code{tmap_format()} the predefined formats can be retrieved. The values for a specific format can be retrieved with \code{tmap_format(format)}, where format is the name of the format. The function \code{tmap_format_add} is used to add a format. +Format options are tmap options that are shape dependent. With \code{tmap_format()} the predefined formats can be retrieved. The values for a specific format can be retrieved with \code{tmap_format(format)}, where format is the name of the format. The function \code{tmap_format_add()} is used to add a format. } \examples{ # available formats diff --git a/man/tmap_icons.Rd b/man/tmap_icons.Rd index 7c6f263d..140682c0 100644 --- a/man/tmap_icons.Rd +++ b/man/tmap_icons.Rd @@ -36,7 +36,7 @@ marker_icon() icon data (see \code{\link[leaflet:icons]{leaflet::icons()}}) } \description{ -Specifies icons from a png images, which can be used as markers in thematic maps. The function \code{marker_icon} is the specification of the default marker. +Specifies icons from a png images, which can be used as markers in thematic maps. The function \code{marker_icon()} is the specification of the default marker. } \seealso{ \code{\link[=tm_symbols]{tm_symbols()}} diff --git a/man/tmap_last.Rd b/man/tmap_last.Rd index 2b59e708..24a64960 100644 --- a/man/tmap_last.Rd +++ b/man/tmap_last.Rd @@ -10,7 +10,7 @@ tmap_last() call } \description{ -Retrieve the last map to be modified or created. Works in the same way as \code{ggplot2}'s \code{\link[ggplot2:last_plot]{ggplot2::last_plot()}}, although there is a difference: \code{last_map} returns the last call instead of the stacked \verb{[tmap-element]s}. +Retrieve the last map to be modified or created. Works in the same way as \code{\link[ggplot2:last_plot]{ggplot2::last_plot()}}, although there is a difference: \code{last_map()} returns the last call instead of the stacked \code{\link{tmap-element}}s. } \seealso{ \code{\link[=tmap_save]{tmap_save()}} diff --git a/man/tmap_leaflet.Rd b/man/tmap_leaflet.Rd index 317bced2..7088b510 100644 --- a/man/tmap_leaflet.Rd +++ b/man/tmap_leaflet.Rd @@ -10,17 +10,28 @@ tmap_leaflet(x, show = FALSE, ...) tmap_grid(x, show = FALSE, ...) } \arguments{ -\item{x}{description} +\item{x}{a tmap object.} \item{show}{show the map?} -\item{...}{arguments passed on the \code{\link[=print.tmap]{print.tmap()}}} +\item{...}{ + Arguments passed on to \code{\link[=print.tmap]{print.tmap}} + \describe{ + \item{\code{return.asp}}{should the aspect ratio be returned?} + \item{\code{vp}}{viewport (for \code{"plot"} mode)} + }} } \value{ -\code{tmap_grid} returns a \code{\link[grid:grid.grob]{grid::grob()}} object (\code{"plot"} mode) and \code{tmap_leaflet} a \code{\link[leaflet:leaflet]{leaflet::leaflet()}} object (\code{"view"} mode). In case small multiples are shown, a list is returned. +\itemize{ +\item \code{tmap_grid()} returns a \code{\link[grid:grid.grob]{grob}} object (\code{"plot"} mode) +\item \code{tmap_leaflet()} a \code{\link[leaflet:leaflet]{leaflet}} object (\code{"view"} mode). In case small multiples are shown, a list is returned. +} } \description{ -Export tmap to the format of the used graphics mode. \code{tmap_grid} returns a \code{\link[grid:grid.grob]{grid::grob()}} object (\verb{"plot" mode}) and \code{tmap_leaflet} a \code{\link[leaflet:leaflet]{leaflet::leaflet()}} object (\code{"view"} mode). +\itemize{ +\item \code{tmap_grid()} returns a \code{\link[grid:grid.grob]{grob}} object (\verb{"plot" mode}) +\item \code{tmap_leaflet()} a \code{\link[leaflet:leaflet]{leaflet}} object (\code{"view"} mode). +} } \examples{ map = tm_shape(World) + tm_polygons() diff --git a/man/tmap_mode.Rd b/man/tmap_mode.Rd index a5b18a4d..aad85031 100644 --- a/man/tmap_mode.Rd +++ b/man/tmap_mode.Rd @@ -16,7 +16,7 @@ ttmp() \item{mode}{One of: \describe{ \item{\code{"plot"}}{Thematic maps are shown in the graphics device. This is the default mode, and supports all tmap's features, such as small multiples (see \code{\link[=tm_facets]{tm_facets()}}) and extensive layout settings (see \code{\link[=tm_layout]{tm_layout()}}). It is recommended for saving static maps (see \code{\link[=tmap_save]{tmap_save()}}).} -\item{\code{"view"}}{Thematic maps are viewed interactively in the web browser or RStudio's Viewer pane. Maps are fully interactive with tiles from OpenStreetMap or other map providers (see \code{\link[=tm_tiles]{tm_tiles()}}). See also \code{\link[=tm_view]{tm_view()}} for options related to the \code{"view"} mode. This mode generates a \code{\link[leaflet:leaflet]{leaflet::leaflet()}} widget, which can also be directly obtained with \code{\link[=tmap_leaflet]{tmap_leaflet()}}. With RMarkdown, it is possible to publish it to an HTML page. +\item{\code{"view"}}{Thematic maps are viewed interactively in the web browser or RStudio's Viewer pane. Maps are fully interactive with tiles from OpenStreetMap or other map providers (see \code{\link[=tm_tiles]{tm_tiles()}}). See also \code{\link[=tm_view]{tm_view()}} for options related to the \code{"view"} mode. This mode generates a \code{\link[leaflet:leaflet]{leaflet::leaflet()}} widget, which can also be directly obtained with \code{\link[=tmap_leaflet]{tmap_leaflet()}}. With R Markdown, it is possible to publish it to an HTML page. There are a couple of constraints in comparison to \code{"plot"}: \itemize{ \item The map is always projected according to the Web Mercator projection. Although this projection is the de facto standard for interactive web-based mapping, it lacks the equal-area property, which is important for many thematic maps, especially choropleths (see examples from \code{\link[=tm_shape]{tm_shape()}}). @@ -30,7 +30,7 @@ There are a couple of constraints in comparison to \code{"plot"}: The mode before changing } \description{ -Set tmap mode to static plotting or interactive viewing. The global option \code{tmap.mode} determines the whether thematic maps are plot in the graphics device, or shown as an interactive leaflet map (see also \code{\link[=tmap_options]{tmap_options()}}. The function \code{tmap_mode} is a wrapper to set this global option. The convenient function \code{ttm}, which stands for toggle thematic map, is a toggle switch between the two modes. The function \code{ttmp} stands for toggle thematic map and print last map: it does the same as \code{ttm} followed by \code{tmap_last}; in order words, it shows the last map in the other mode. It is recommended to use \code{tmap_mode} in scripts and \code{ttm}/\code{ttmp} in the console. +Set tmap mode to static plotting or interactive viewing. The global option \code{tmap.mode} determines the whether thematic maps are plot in the graphics device, or shown as an interactive leaflet map (see also \code{\link[=tmap_options]{tmap_options()}}. The function \code{tmap_mode} is a wrapper to set this global option. The convenient function \code{ttm}, which stands for toggle thematic map, is a toggle switch between the two modes. The function \code{ttmp} stands for toggle thematic map and print last map: it does the same as \code{ttm} followed by \code{\link[=tmap_last]{tmap_last()}}; in order words, it shows the last map in the other mode. It is recommended to use \code{tmap_mode()} in scripts and \code{ttm}/\code{ttmp} in the console. } \examples{ tmap_mode() diff --git a/man/tmap_options.Rd b/man/tmap_options.Rd index a3bd4028..18c5e1bf 100644 --- a/man/tmap_options.Rd +++ b/man/tmap_options.Rd @@ -28,7 +28,7 @@ tmap_options_save(style) \item{default.options}{return the default options or the current options?} -\item{style}{style, see \code{tmap_style()} for available styles} +\item{style}{style, see \code{\link[=tmap_style]{tmap_style()}} for available styles} } \description{ tmap options @@ -55,7 +55,7 @@ tmap options values.range \tab Default range for values. See \code{values.range} of \code{\link[=tm_scale_categorical]{tm_scale_categorical()}}. A list is required with per visual variable a value. \cr value.neutral \tab Default values for when a data variable to mapped to a visual variable, e.g. a color palette. A list is required with per visual variable a value. \cr scales.var \tab Default scales. \cr - label.format \tab Format for the labels (was legend.format in tmap v3) \cr + label.format \tab Format for the labels (was \code{legend.format} in tmap v3) \cr label.na \tab Default label for missing values \cr See \code{\link[=tm_layout]{tm_layout()}} for layout specific options \tab \cr } diff --git a/man/tmap_save.Rd b/man/tmap_save.Rd index 5fe4a347..bd08d59d 100644 --- a/man/tmap_save.Rd +++ b/man/tmap_save.Rd @@ -29,9 +29,9 @@ tmap_save( \item{filename}{filename including extension, and optionally the path. The extensions pdf, eps, svg, wmf (Windows only), png, jpg, bmp, tiff, and html are supported. If the extension is missing, the file will be saved as a static plot in \code{"plot"} mode and as an interactive map (html) in \code{"view"} mode (see details). The default format for static plots is png, but this can be changed using the option \code{"output.format"} in \code{\link[=tmap_options]{tmap_options()}}. If \code{NA} (the default), the file is saved as "tmap01" in the default format, and the number incremented if the file already exists.} -\item{device}{graphic device to use. Either a device function (e.g., \code{\link[grDevices:png]{grDevices::png()}} or \code{\link[grDevices:cairo]{grDevices::cairo_pdf()}}) or a text indicating selected graphic device: "pdf", "eps", "svg", "wmf" (Windows only), "png", "jpg", "bmp", "tiff". If NULL, the graphic device is guessed based on the \code{filename} argument.} +\item{device}{graphic device to use. Either a device function (e.g., \code{\link[grDevices:png]{png}} or \code{\link[grDevices:cairo]{cairo_pdf}}) or a text indicating selected graphic device: "pdf", "eps", "svg", "wmf" (Windows only), "png", "jpg", "bmp", "tiff". If NULL, the graphic device is guessed based on the \code{filename} argument.} -\item{height, width}{The width and height of the plot (not applicable for html files). Units are set with the argument \code{units}. If one of them is not specified, this is calculated using the formula asp = width / height, where asp is the estimated aspect ratio of the map. If both are missing, they are set such that width * height is equal to the option \code{"output.size"} in \code{\link[=tmap_options]{tmap_options()}}. This is by default 49, meaning that is the map is a square (so aspect ratio of 1) both width and height are set to 7.} +\item{height, width}{The width and height of the plot (not applicable for html files). Units are set with the argument \code{units}. If one of them is not specified, this is calculated using the formula asp = width / height, where asp is the estimated aspect ratio of the map. If both are missing, they are set such that \code{width * height} is equal to the option \code{"output.size"} in \code{\link[=tmap_options]{tmap_options()}}. This is by default 49, meaning that is the map is a square (so aspect ratio of 1) both width and height are set to 7.} \item{units}{units for width and height (\code{"in"}, \code{"cm"}, or \code{"mm"}). By default, pixels (\code{"px"}) are used if either width or height is set to a value greater than 50. Else, the units are inches (\code{"in"})} @@ -45,17 +45,17 @@ tmap_save( \item{insets_tm}{tmap object of an inset map, or a list of tmap objects of multiple inset maps. The number of tmap objects should be equal to the number of viewports specified with \code{insets_vp}.} -\item{insets_vp}{\code{\link[grid:viewport]{grid::viewport()}} of an inset map, or a list of \code{\link[grid:viewport]{grid::viewport()}}s of multiple inset maps. The number of viewports should be equal to the number of tmap objects specified with \code{insets_tm}.} +\item{insets_vp}{\code{\link[grid:viewport]{viewport}} of an inset map, or a list of \code{\link[grid:viewport]{viewport}}s of multiple inset maps. The number of viewports should be equal to the number of tmap objects specified with \code{insets_tm}.} -\item{add.titles}{add titles to leaflet object} +\item{add.titles}{add titles to leaflet object.} -\item{in.iframe}{should an interactive map be saved as an iframe? If so, two HTML files will be saved; one small parent HTML file with the iframe container, and one large child HTML file with the actual widget. See \code{\link[widgetframe:saveWidgetframe]{widgetframe::saveWidgetframe()}} for details. By default \code{FALSE} which means that one large HTML file is saved (see \code{\link[htmlwidgets:saveWidget]{htmlwidgets::saveWidget()}}).} +\item{in.iframe}{should an interactive map be saved as an iframe? If so, two HTML files will be saved; one small parent HTML file with the iframe container, and one large child HTML file with the actual widget. See \code{\link[widgetframe:saveWidgetframe]{widgetframe::saveWidgetframe()}} for details. By default \code{FALSE} which means that one large HTML file is saved (see \link[htmlwidgets:saveWidget]{saveWidget()}).} \item{selfcontained}{when an interactive map is saved, should the resources (e.g. Javascript libraries) be contained in the HTML file? If \code{FALSE}, they are placed in an adjacent directory (see also \code{\link[htmlwidgets:saveWidget]{htmlwidgets::saveWidget()}}). Note that the HTML file will often still be large when \code{selfcontained = FALSE}, since the map data (polygons and popups), which are also contained in the HTML file, usually take more space then the map resources.} \item{verbose}{Deprecated. It is now controlled by the tmap option \code{show.messages} (see \code{\link[=tmap_options]{tmap_options()}})} -\item{...}{arguments passed on to device functions or to \code{\link[htmlwidgets:saveWidget]{htmlwidgets::saveWidget()}} or \code{\link[widgetframe:saveWidgetframe]{widgetframe::saveWidgetframe()}}} +\item{...}{arguments passed on to device functions or to \code{\link[htmlwidgets:saveWidget]{saveWidget()}} or \code{\link[widgetframe:saveWidgetframe]{saveWidgetFrame()}}} } \description{ Save tmap to a file. This can be either a static plot (e.g. png) or an interactive map (html). diff --git a/man/tmap_style.Rd b/man/tmap_style.Rd index 4ff35e61..592e8e39 100644 --- a/man/tmap_style.Rd +++ b/man/tmap_style.Rd @@ -7,7 +7,7 @@ tmap_style(style) } \arguments{ -\item{style}{Name of the style. When omitted, \code{tmap_style} returns the current style and also shows all available styles. When the style is specified, \code{tmap_style} sets the style accordingly. Note that in that case, all tmap options (see \code{\link[=tmap_options]{tmap_options()}}) will be reset according to the style definition. See \code{\link[=tm_layout]{tm_layout()}} for predefined styles, and \code{tmap_style_catalogue} (not migrated to v4 yet) for creating a catalogue.} +\item{style}{Name of the style. When omitted, \code{tmap_style()} returns the current style and also shows all available styles. When the style is specified, \code{tmap_style()} sets the style accordingly. Note that in that case, all tmap options (see \code{\link[=tmap_options]{tmap_options()}}) will be reset according to the style definition. See \code{\link[=tm_layout]{tm_layout()}} for predefined styles, and \code{tmap_style_catalogue} (not migrated to v4 yet) for creating a catalogue.} } \value{ The style before changing @@ -16,7 +16,7 @@ The style before changing Set or get the default tmap style. Without arguments, the current style is returned. Also the available styles are displayed. When a style is set, the corresponding tmap options (see \code{\link[=tmap_options]{tmap_options()}}) will be set accordingly. The default style (i.e. when loading the package) is \code{"white"}. } \details{ -Note that \code{\link[=tm_style]{tm_style()}} is used within a plot call (so it only affects that plot), whereas \code{tmap_style} sets the style globally. +Note that \code{\link[=tm_style]{tm_style()}} is used within a plot call (so it only affects that plot), whereas \code{tmap_style()} sets the style globally. After loading a style, the options that defined this style (i.e. the difference with the default \code{"white"} style) can be obtained by \code{\link[=tmap_options_diff]{tmap_options_diff()}}.