% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tm_component_functions.R
\name{tm_scalebar}
\alias{tm_scalebar}
\title{Map component: scale bar}
\usage{
tm_scalebar(
  breaks,
  width,
  allow_clipping,
  text.size,
  text.color,
  color.dark,
  color.light,
  lwd,
  position,
  group_id,
  bg,
  bg.color,
  bg.alpha,
  size = "deprecated",
  stack,
  frame,
  frame.color,
  frame.alpha,
  frame.lwd,
  frame.r,
  margins,
  z
)
}
\arguments{
\item{breaks}{Scale bar break positions. E.g. \code{c(0, 10, 50)} places breaks
at 0, 10, and 50 units. The unit is controlled by the \code{unit} argument from \code{\link[=tm_shape]{tm_shape()}}.
When \code{NULL} (default), break positions are chosen automatically.}

\item{width}{Width of the scale bar, in number of text line heights (roughly
equivalent to character widths). When \code{breaks} are specified, \code{width} is
only useful for fine-tuning, e.g. to prevent label clipping or reduce
excess whitespace.}

\item{allow_clipping}{Should clipping of the last label be allowed? If
\code{TRUE} (default), the last break label including its unit suffix is printed
even when it extends beyond the frame. If \code{FALSE}, that label is suppressed
and the unit suffix is appended to the second-to-last label instead.}

\item{text.size}{text size}

\item{text.color}{text.color}

\item{color.dark}{color.dark}

\item{color.light}{color.light}

\item{lwd}{linewidth}

\item{position}{The position specification of the component: an object created with \code{tm_pos_in()} or \code{tm_pos_out()}. Or, as a shortcut, a vector of two values, specifying the x and y coordinates. The first is \code{"left"}, \code{"center"} or \code{"right"} (or upper case, meaning tighter to the map frame), the second \code{"top"}, \code{"center"} or \code{"bottom"}. Numeric values are also supported, where 0, 0 means left bottom and 1, 1 right top. See also vignette: \href{https://r-tmap.github.io/tmap/articles/adv_positions}{Positioning of components}. In case multiple components should be combined (stacked), use \code{group_id} and specify \code{component} in \code{\link[=tm_components]{tm_components()}}.}

\item{group_id}{Component group id name. All components (e.g. legends, titles, etc) with the same \code{group_id} will be grouped. The specifications of how they are placed (e.g. stacking, margins etc.) are determined in \code{\link[=tm_components]{tm_components()}} where its argument \code{id} should correspond to \code{group_id}.}

\item{bg}{Show background?}

\item{bg.color}{Background color}

\item{bg.alpha}{Background transparency}

\item{size}{Deprecated (use \code{text.size} instead)}

\item{stack}{stack with other map components, either \code{"vertical"} or \code{"horizontal"}.}

\item{frame}{frame should a frame be drawn?}

\item{frame.color}{frame color}

\item{frame.alpha}{frame alpha transparancy}

\item{frame.lwd}{frame line width}

\item{frame.r}{Radius of the rounded frame corners. 0 means no rounding.}

\item{margins}{margins}

\item{z}{z index, e.g. the place of the component relative to the other componets}
}
\description{
Map component that adds a scale bar.
}
\seealso{
\href{https://r-tmap.github.io/tmap/articles/basics_components}{Components}, \href{https://r-tmap.github.io/tmap/articles/adv_positions}{Positioning of components}, \href{https://r-tmap.github.io/tmap/articles/adv_comp_group}{Grouping of components}, \href{https://r-tmap.github.io/tmap/articles/examples_choro_NLD}{Choropleth (Netherlands)}
}
