Skip to content

Commit

Permalink
docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Nov 20, 2024
1 parent 82df76f commit de1b2a3
Show file tree
Hide file tree
Showing 32 changed files with 1,195 additions and 1,234 deletions.
4 changes: 2 additions & 2 deletions R/misc_crs.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ crs_ortho_visible = function(crs, projected = TRUE, max_cells = 1e5) {
if (projected) sf::st_transform(sfc, crs) else sfc
}

end_of_the_world = function(crs, earth.datum) {
end_of_the_world = function(crs, earth_datum) {
wkt = sf::st_crs(crs)$wkt

# orthographic
Expand All @@ -119,7 +119,7 @@ end_of_the_world = function(crs, earth.datum) {
sf::st_as_sfc() |>
sf::st_set_crs(NA) |>
sf::st_segmentize(1) |>
sf::st_set_crs(earth.datum) |>
sf::st_set_crs(earth_datum) |>
sf::st_transform(crs)
}

Expand Down
14 changes: 7 additions & 7 deletions R/step1_helper_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ preprocess_meta_step1 = function(o) {
# panel.label.size = panel.label.size * scale

space.color = ifelse(is.null(space.color), bg.color, space.color[1])
earth.boundary.color = ifelse(is.null(earth.boundary.color), attr.color, earth.boundary.color[1])
earth_boundary.color = ifelse(is.null(earth_boundary.color), attr.color, earth_boundary.color[1])
legend.text.color = ifelse(is.null(legend.text.color), attr.color, legend.text.color[1])
legend.title.color = ifelse(is.null(legend.title.color), attr.color, legend.title.color[1])
title.color = ifelse(is.null(title.color), attr.color, title.color[1])
Expand Down Expand Up @@ -73,7 +73,7 @@ preprocess_meta_step1 = function(o) {
panel.label.color = do.call("process_color", c(list(col=panel.label.color), pc))
panel.label.bg.color = do.call("process_color", c(list(col=panel.label.bg.color), pc))

earth.boundary.color = do.call("process_color", c(list(col=earth.boundary.color), pc))
earth_boundary.color = do.call("process_color", c(list(col=earth_boundary.color), pc))

if (is.na(bg.color) && pc$sepia_intensity != 0) bg.color = "#FFFFFF"
bg.color = do.call("process_color", c(list(col=bg.color), pc))
Expand All @@ -90,17 +90,17 @@ preprocess_meta_step1 = function(o) {
do.call("process_color", c(list(col=legend.bg.color, alpha=legend.bg.alpha), pc)) }
}
if (!is.na(title.bg.color)) title.bg.color = do.call("process_color", c(list(col=title.bg.color, alpha=title.bg.alpha), pc))
if (!is.na(earth.boundary.color)) earth.boundary.color = do.call("process_color", c(list(col=earth.boundary.color), pc))
if (!is.na(earth_boundary.color)) earth_boundary.color = do.call("process_color", c(list(col=earth_boundary.color), pc))
space.color = do.call("process_color", c(list(col=space.color), pc))

earth.bounds = if (is.logical(earth.boundary)) {
earth.bounds = if (is.logical(earth_boundary)) {
c(-180, -90, 180, 90)
} else {
as.vector(bb(earth.boundary))
as.vector(bb(earth_boundary))
}
earth.boundary = !isFALSE(earth.boundary)
earth_boundary = !isFALSE(earth_boundary)

earth.boundary.lwd = earth.boundary.lwd * scale
earth_boundary.lwd = earth_boundary.lwd * scale
#frame.lwd = frame.lwd * scale

# set font face and family
Expand Down
2 changes: 1 addition & 1 deletion R/step1_rearrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ step1_rearrange = function(tmel) {


# disable s2 in case earth.boundaries are drawn
if (o$earth.boundary && sf::sf_use_s2()) {
if (o$earth_boundary && sf::sf_use_s2()) {
suppressMessages(sf::sf_use_s2(FALSE))
.TMAP$set_s2 = TRUE
}
Expand Down
18 changes: 9 additions & 9 deletions R/tm_layers_iso.R
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#' Map layer: iso (contour)
#'
#'
#' Map layer that draws iso (contour) lines. Stack of [tm_lines()] and [tm_labels_highlighted].
#'
#' @param col Visual variable that determines the color of the lines
#' @param text Visual variable that determines the text
#' @param ... passed on to [tm_lines()] and [tm_labels_highlighted()]. For the text color and alpha transparency of the text labels, please use `text_col` and `text_alpha` instead of `col` and `col_alpha`.
#'
#' @param col `r .doc_vv("col")`
#' @param text `r .doc_vv("text")`
#' @param ... passed on to [tm_lines()] and [tm_labels_highlighted()]. For the text color and alpha transparency of the text labels, please use `text_col` and `text_alpha` instead of `col` and `col_alpha`.
#' @param options_lines The options for [tm_lines()]
#' @param options_labels The options for [tm_labels_highlighted()]
#' @export
tm_iso = function(col, text, ..., options_lines = opt_tm_lines(), options_labels = opt_tm_labels()) {
args = list(...)
args$options = NULL
argsL = args[intersect(names(formals("tm_lines")), names(args))]

nms_col = c("col", "col.scale", "col.legend", "col.chart", "col.free", "col_alpha", "col_alpha.scale", "col_alpha.legend", "col_alpha.chart", "col_alpha.free")

# update args for labels
args[nms_col] = NULL
rename_id = names(args) %in% paste0("text_", nms_col)

names(args)[rename_id] = substr(names(args)[rename_id], 6, nchar(names(args)[rename_id]))
argsT = args[intersect(names(formals("tm_labels_highlighted")), names(args))]

do.call("tm_lines", c(list(col=col, options = options_lines), argsL)) +
do.call("tm_labels_highlighted", c(list(text=text, options = options_labels), argsT))
}
8 changes: 4 additions & 4 deletions R/tm_layers_lines.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#' ([tm_facets_wrap()] and [tm_facets_stack()]) there is only one facet dimension,
#' so the `*.free` argument requires only one logical value.
#'
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines the col color. See details.
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free Visual variable that determines the line width. See details.
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free Visual variable that determines the line type. See details.
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free Visual variable that determines the border color alpha transparency. See details.
#' @param col,col.scale,col.legend,col.chart,col.free `r .doc_vv("col")`
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free `r .doc_vv("lwd")`
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free `r .doc_vv("lty")`
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free `r .doc_vv("col_alpha")`
#' @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 options options passed on to the corresponding `opt_<layer_function>` function
Expand Down
14 changes: 6 additions & 8 deletions R/tm_layers_polygons.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
#' ([tm_facets_wrap()] and [tm_facets_stack()]) there is only one facet dimension,
#' so the `*.free` argument requires only one logical value.
#'
#' @param fill,fill.scale,fill.legend,fill.chart,fill.free Visual variable that determines the fill color. See details.
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines the border color. See details.
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free Visual variable that determines the line width. See details.
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free Visual variable that determines the line type. See details.
#' @param fill_alpha,fill_alpha.scale,fill_alpha.chart,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.chart,col_alpha.free Visual variable
#' that determines the border color alpha transparency. See details.
#' @param fill,fill.scale,fill.legend,fill.chart,fill.free `r .doc_vv("fill")`
#' @param col,col.scale,col.legend,col.chart,col.free `r .doc_vv("col")`
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free `r .doc_vv("lwd")`
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free `r .doc_vv("lty")`
#' @param fill_alpha,fill_alpha.scale,fill_alpha.chart,fill_alpha.legend,fill_alpha.free `r .doc_vv("fill_alpha")`
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free `r .doc_vv("col_alpha")`
#' @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.
Expand Down
6 changes: 2 additions & 4 deletions R/tm_layers_raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@
#' ([tm_facets_wrap()] and [tm_facets_stack()]) there is only one facet dimension,
#' so the `*.free` argument requires only one logical value.
#'
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines the color.
#' See details.
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free Visual variable
#' that determines the alpha transparency. See details.
#' @param col,col.scale,col.legend,col.chart,col.free `r .doc_vv("col")`
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free `r .doc_vv("col_alpha")`
#' @inheritParams tm_polygons
#' @param options options passed on to the corresponding `opt_<layer_function>` function
#' @param ... to catch deprecated arguments from version < 4.0
Expand Down
2 changes: 1 addition & 1 deletion R/tm_layers_rgb.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' fourth is the alpha transparency channel.
#'
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines
#' the col color. `col` is a multivariate variable, with 3 (`tm_rgb`) or 4 (`tm_rgba`) numeric data variables. These can be specified via [tm_vars()] with `multivariate = TRUE`
#' the color. `col` is a multivariate variable, with 3 (`tm_rgb`) or 4 (`tm_rgba`) numeric data variables. These can be specified via [tm_vars()] with `multivariate = TRUE`
#' @param options options passed on to the corresponding `opt_<layer_function>` function
#' @param ... to catch deprecated arguments from version < 4.0
#' @example ./examples/tm_rgb.R
Expand Down
24 changes: 8 additions & 16 deletions R/tm_layers_sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,14 @@
#' [tm_facets_stack()]) there is only one facet dimension, so the `.free` argument requires
#' only one logical value.
#'
#' @param fill,fill.scale,fill.legend,fill.free Visual variable that determines
#' the fill color. See details.
#' @param col,col.scale,col.legend,col.free Visual variable that determines
#' the col color. See details.
#' @param size,size.scale,size.legend,size.free Visual variable that determines
#' the size. See details.
#' @param shape,shape.scale,shape.legend,shape.free Visual variable that determines
#' the shape. See details.
#' @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 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 fill,fill.scale,fill.legend,fill.free `r .doc_vv("fill")`
#' @param col,col.scale,col.legend,col.free `r .doc_vv("col")`
#' @param size,size.scale,size.legend,size.free `r .doc_vv("size")`
#' @param shape,shape.scale,shape.legend,shape.free `r .doc_vv("shape")`
#' @param lwd,lwd.scale,lwd.legend,lwd.free `r .doc_vv("lwd")`
#' @param lty,lty.scale,lty.legend,lty.free `r .doc_vv("lty")`
#' @param fill_alpha,fill_alpha.scale,fill_alpha.legend,fill_alpha.free `r .doc_vv("fill_alpha")`
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.free `r .doc_vv("col_alpha")`
#' @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.
Expand Down
19 changes: 9 additions & 10 deletions R/tm_layers_symbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@
#' To specify multiple shapes (needed for the \code{shapes} argument), a vector or list of these shape specification is required. The shape specification options can also be mixed. For the \code{shapes} argument, it is possible to use a named vector or list, where the names correspond to the value of the variable specified by the \code{shape} argument.
#' For small multiples, a list of these shape specification(s) should be provided.
#'
#' @param fill,fill.scale,fill.legend,fill.chart,fill.free Visual variable that determines the fill color. See details.
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines the col color. See details.
#' @param size,size.scale,size.legend,size.chart,size.free Visual variable that determines the size. See details.
#' @param shape,shape.scale,shape.legend,shape.chart,shape.free Visual variable that determines the shape. See details.
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free Visual variable that determines the line width. See details.
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free Visual variable that determines the line type. See details.
#' @param fill_alpha,fill_alpha.scale,fill_alpha.legend,fill_alpha.chart,fill_alpha.free Visual variable that determines
#' @param fill,fill.scale,fill.legend,fill.chart,fill.free `r .doc_vv("fill")`
#' @param col,col.scale,col.legend,col.chart,col.free `r .doc_vv("col")`
#' @param size,size.scale,size.legend,size.chart,size.free `r .doc_vv("size")`
#' @param shape,shape.scale,shape.legend,shape.chart,shape.free `r .doc_vv("shape")`
#' @param lwd,lwd.scale,lwd.legend,lwd.chart,lwd.free `r .doc_vv("lwd")`
#' @param lty,lty.scale,lty.legend,lty.chart,lty.free `r .doc_vv("lty")`
#' @param fill_alpha,fill_alpha.scale,fill_alpha.legend,fill_alpha.chart,fill_alpha.free `r .doc_vv("fill_alpha")`
#' the fill color alpha transparency See details.
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free Visual variable that determines
#' the border color alpha transparency. See details.
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free `r .doc_vv("col_alpha")`
#' @param plot.order Specification in which order the spatial features are drawn.
#' See [tm_plot_order()] for details.
#' @param options options passed on to the corresponding `opt_<layer_function>` function
Expand Down Expand Up @@ -675,7 +674,7 @@ tm_markers = function(text = tm_const(),

#' @inheritParams opt_tm_labels
#' @param markers.on.top.of.text should markers be plot on top of the text (by default `FALSE`)
#' @param dots.icon.scale scaling number that determines how large the icons (or grobs) are in plot mode in comparison to proportional symbols (such as bubbles). In view mode, the size is determined by the icon specification (see \code{\link{tmap_icons}}) or, if grobs are specified by \code{grob.width} and \code{grob.heigth}
#' @param dots.icon.scale scaling number that determines how large the icons (or grobs) are in plot mode in comparison to proportional symbols (such as bubbles). In view mode, the size is determined by the icon specification (see \code{\link{tmap_icons}}) or, if grobs are specified by \code{grob.width} and \code{grob.height}
#' @param dots.just justification of the text relative to the point coordinates. Either one of the following values: \code{"left"} , \code{"right"}, \code{"center"}, \code{"bottom"}, and \code{"top"}, or a vector of two values where first value specifies horizontal and the second value vertical justification. Besides the mentioned values, also numeric values between 0 and 1 can be used. 0 means left justification for the first value and bottom justification for the second value. Note that in view mode, only one value is used.
#' @param dots.grob.dim vector of four values that determine how grob objects (see details) are shown in view mode. The first and second value are the width and height of the displayed icon. The third and fourth value are the width and height of the rendered png image that is used for the icon. Generally, the third and fourth value should be large enough to render a ggplot2 graphic successfully. Only needed for the view mode.
#' @rdname tm_symbols
Expand Down
15 changes: 5 additions & 10 deletions R/tm_layers_text.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@
#' 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.chart,text.free Visual variable that determines
#' the text. See details.
#' @param size,size.scale,size.legend,size.chart,size.free Visual variable that determines
#' the font size. See details.
#' @param col,col.scale,col.legend,col.chart,col.free Visual variable that determines
#' the col color. See details.
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free Visual variable that determines
#' the border color alpha transparency. See Details.
#' @param fontface,fontface.scale,fontface.legend,fontface.chart,fontface.free Visual variable that determines
#' the font face. See Details.
#' @param text,text.scale,text.legend,text.chart,text.free `r .doc_vv("text")`
#' @param size,size.scale,size.legend,size.chart,size.free `r .doc_vv("size")`
#' @param col,col.scale,col.legend,col.chart,col.free `r .doc_vv("col")`
#' @param col_alpha,col_alpha.scale,col_alpha.legend,col_alpha.chart,col_alpha.free `r .doc_vv("col_alpha")`
#' @param fontface,fontface.scale,fontface.legend,fontface.chart,fontface.free `r .doc_vv("fontface")`
#' @param fontfamily The font family. See [gpar()][grid::gpar()] for details.
#' @param bgcol,bgcol.scale,bgcol.legend,bgcol.chart,bgcol.free Visual variable that determines
#' the background color. See Details.
Expand Down
Loading

0 comments on commit de1b2a3

Please sign in to comment.