diff --git a/R/tmap_leaflet.R b/R/tmap_export.R similarity index 83% rename from R/tmap_leaflet.R rename to R/tmap_export.R index 568425dc..dc00cd78 100644 --- a/R/tmap_leaflet.R +++ b/R/tmap_export.R @@ -1,12 +1,13 @@ #' Export tmap to the format of the used graphics mode -#' +#' #' * `tmap_grob()` returns a [`grob`][grid::grob()] object (`"plot" mode`) #' * `tmap_leaflet()` a [`leaflet`][leaflet::leaflet()] object (`"view"` mode). -#' +#' #' @param x a tmap object. +#' @param asp,scale the desired aspect ratio and scale of the map. Only applicable for `"plot"` mode. #' @param show show the map? #' @inheritDotParams print.tmap -#' @return +#' @return #' * `tmap_grob()` 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. @@ -32,6 +33,8 @@ tmap_leaflet = function(x, #' @rdname tmap_leaflet #' @export tmap_grob = function(x, + asp = NA, + scale = 1, show = FALSE, ...) { current_mode = getOption("tmap.mode") @@ -39,5 +42,5 @@ tmap_grob = function(x, options(tmap.mode = current_mode) }) options(tmap.mode = "plot") - print.tmap(x, show = show, ...) + print.tmap(x + tm_options(asp = asp, scale = scale), show = show, ...) } diff --git a/man/tmap_animation.Rd b/man/tmap_animation.Rd index 1dccb79a..914f241b 100644 --- a/man/tmap_animation.Rd +++ b/man/tmap_animation.Rd @@ -60,7 +60,7 @@ the edges of the image.} \item{restart.delay}{not used anymore.} -\item{...}{arguments passed on to \code{\link[av:av_encode_video]{av::av_encode_video()}}} +\item{...}{arguments passed on to \code{\link[av:encoding]{av::av_encode_video()}}} } \description{ Create a gif animation or video from a tmap plot. diff --git a/man/tmap_leaflet.Rd b/man/tmap_leaflet.Rd index f9beacfc..cbb3254b 100644 --- a/man/tmap_leaflet.Rd +++ b/man/tmap_leaflet.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tmap_leaflet.R +% Please edit documentation in R/tmap_export.R \name{tmap_leaflet} \alias{tmap_leaflet} \alias{tmap_grob} @@ -7,7 +7,7 @@ \usage{ tmap_leaflet(x, show = FALSE, ...) -tmap_grob(x, show = FALSE, ...) +tmap_grob(x, asp = NA, scale = 1, show = FALSE, ...) } \arguments{ \item{x}{a tmap object.} @@ -24,6 +24,8 @@ tmap_grob(x, show = FALSE, ...) \item{\code{proxy}}{A logical, if \code{in.shiny}, is \code{\link{tmapProxy}} used?} \item{\code{options}}{A vector of options} }} + +\item{asp, scale}{the desired aspect ratio and scale of the map. Only applicable for \code{"plot"} mode.} } \value{ \itemize{