Skip to content

Commit

Permalink
Wrap long lines + redocument
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Sep 20, 2023
1 parent 9883d8e commit f9fd4e6
Show file tree
Hide file tree
Showing 62 changed files with 1,548 additions and 497 deletions.
2 changes: 1 addition & 1 deletion R/tm_components.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ tm_compass <- function(north,
#'
#' 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()]).
#' confusion with the `tm_scale_*()` scaling functions (like [tm_scale_continuous()]).
#'
#' @param breaks breaks
#' @param width width
Expand Down
8 changes: 6 additions & 2 deletions R/tm_element.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@ 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::last_plot()], although there is a difference: `tmap_last()` 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:
#' `tmap_last()` returns the last call instead of the stacked [`tmap-element`]s.
#'
#' @return call
#' @export
#' @seealso [tmap_save()]
tmap_last = function() {
.x = get("last_map", envir = .TMAP)
if (is.null(.x) && get("tmapOptions", envir = .TMAP)$show.warnings) warning("A map has not been created yet")
if (is.null(.x) && get("tmapOptions", envir = .TMAP)$show.warnings) {
warning("A map has not been created yet")
}
eval(.x)
}

Expand Down
45 changes: 37 additions & 8 deletions R/tm_facets.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#' 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)
Expand All @@ -11,14 +16,38 @@
#' @param ncols Number of columns
#' @param byrow Should facets be wrapped by row?
#' @param orientation For facet stack: horizontal or vertical?
#' @param free.coords Logical. If the `by` argument is specified, should each map has its own coordinate ranges? By default `TRUE`, unless facets are shown in as different layers (`as.layers = TRUE`)
#' @param drop.units Logical. If the `by` argument is specified, should non-selected spatial units be dropped? If `FALSE`, they are plotted where mapped aesthetics are regarded as missing values. Not applicable for raster shapes. By default `TRUE`.
#' @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 [table()][base::table()], where `TRUE`, `FALSE`, and `NA` correspond to `"always"`, `"no"`, and `"ifany"` respectively.
#' @param free.coords Logical. If the `by` argument is specified, should each
#' map has its own coordinate ranges? By default `TRUE`, unless facets are shown
#' in as different layers (`as.layers = TRUE`)
#' @param drop.units Logical. If the `by` argument is specified, should
#' non-selected spatial units be dropped? If `FALSE`, they are plotted where
#' mapped aesthetics are regarded as missing values. Not applicable for
#' raster shapes. By default `TRUE`.
#' @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 [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 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 deprecated Please use `tm_facets_page()`
#' @export
Expand Down
Loading

0 comments on commit f9fd4e6

Please sign in to comment.