% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tmap_mode.R
\name{tmap_mode}
\alias{tmap_mode}
\alias{ttm}
\alias{rtm}
\alias{tmap_mode_pool}
\alias{ttmp}
\alias{rtmp}
\title{Set tmap mode}
\usage{
tmap_mode(mode = NULL, silent = FALSE)

ttm()

rtm()

tmap_mode_pool(modes = NULL, silent = FALSE)

ttmp()

rtmp()
}
\arguments{
\item{mode}{A string specifying the mode. See \code{\link[=tmap_options]{tmap_options()}} for available modes.}

\item{silent}{Should the mode be switched silently? Default \code{FALSE}.}

\item{modes}{Character vector of mode names (minimum 2), or \code{NULL} to reset.}
}
\value{
\itemize{
\item \code{tmap_mode()} returns the current mode invisibly when called without argument,
otherwise the previous mode.
\item \code{ttm()}, \code{rtm()} return the previous mode invisibly.
\item \code{tmap_mode_pool()} returns the previous pool invisibly.
}
}
\description{
\itemize{
\item \code{tmap_mode()} gets (no argument) or sets the current mode.
\item \code{ttm()} toggles between the two most recent modes.
\item \code{ttmp()} same as \code{ttm()}, then calls \code{\link[=tmap_last]{tmap_last()}}.
\item \code{rtm()} rotates through all modes in the pool.
\item \code{rtmp()} same as \code{rtm()}, then calls \code{\link[=tmap_last]{tmap_last()}}.
\item \code{tmap_mode_pool()} restricts which modes are cycled by \code{\link[=ttm]{ttm()}} and \code{\link[=rtm]{rtm()}}.
Call without arguments to inspect the current pool, or pass \code{NULL} to reset.
}

It is recommended to use \code{tmap_mode()} in scripts and \code{ttm()}/\code{ttmp()} in the console.
}
\details{
The default modes are \code{"plot"} (static, graphics device) and \code{"view"} (interactive,
browser or RStudio Viewer). Additional modes such as \code{"maplibre"} and \code{"mapbox"} become
available when \pkg{tmap.mapgl} is loaded.
}
\examples{
current.mode = tmap_mode()

tmap_mode("plot")

tm_shape(World) + tm_polygons("HPI")

tmap_mode("view")

tm_shape(World) + tm_polygons("HPI")

ttm()

tm_shape(World) + tm_polygons("HPI")

tmap_mode(current.mode)
}
\references{
Tennekes, M., 2018, {tmap}: Thematic Maps in {R},
Journal of Statistical Software, 84(6), 1-39, \doi{10.18637/jss.v084.i06}
}
\seealso{
\itemize{
\item .doc_see_also_modes()
\item \code{\link[=tmap_last]{tmap_last()}} to show the last map
\item \code{\link[=tm_view]{tm_view()}} for viewing options
\item \code{\link[=tmap_leaflet]{tmap_leaflet()}} for obtaining a leaflet widget
\item \code{\link[=tmap_options]{tmap_options()}} for tmap options
}
}
