% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tm_chart.R
\name{tm_chart}
\alias{tm_chart}
\alias{tm_chart_histogram}
\alias{tm_chart_bar}
\alias{tm_chart_donut}
\alias{tm_chart_violin}
\alias{tm_chart_box}
\alias{tm_chart_none}
\alias{tm_chart_heatmap}
\title{Legend charts}
\usage{
tm_chart_histogram(
  breaks,
  plot.axis.x,
  plot.axis.y,
  extra.ggplot2,
  position,
  width,
  height,
  stack,
  z,
  group.frame,
  resize.as.group
)

tm_chart_bar(
  plot.axis.x,
  plot.axis.y,
  extra.ggplot2,
  position,
  width,
  height,
  stack,
  z,
  group.frame,
  resize.as.group
)

tm_chart_donut(position, width, height, stack, z, group.frame, resize.as.group)

tm_chart_violin(
  position,
  width,
  height,
  stack,
  z,
  group.frame,
  resize.as.group
)

tm_chart_box(position, width, height, stack, z, group.frame, resize.as.group)

tm_chart_none()

tm_chart_heatmap(
  position,
  width,
  height,
  stack,
  z,
  group.frame,
  resize.as.group
)
}
\arguments{
\item{breaks}{The breaks of the bins (for histograms)}

\item{plot.axis.x, plot.axis.y}{Should the x axis and y axis be plot?}

\item{extra.ggplot2}{Extra ggplot2 code}

\item{position}{Position of the chart. See \code{\link[=tm_pos]{tm_pos()}} for details}

\item{width}{in number of text lines (height of it)}

\item{height}{in number of text lines}

\item{stack}{stack with other map components?}

\item{z}{stacking order}

\item{group.frame}{group.frame}

\item{resize.as.group}{resize.as.group}
}
\description{
Legend charts are small charts that are added to the map, usually in addition to legends.
}
\details{
Note that these charts are different from charts drawn inside the map. Those are called glyphs (to be implemented).
}
\examples{
## numerical variable

tm_shape(World) + 
  tm_polygons("HPI", 
    fill.scale = tm_scale_intervals(), 
    fill.chart = tm_chart_histogram())

tm_shape(World) + 
	tm_polygons("HPI", 
				fill.scale = tm_scale_continuous(), 
				fill.chart = tm_chart_histogram(
					position = tm_pos_out("center", "bottom"),
					width = 30)
				)

tm_shape(World) + 
	tm_polygons("HPI", 
				fill.scale = tm_scale_intervals(), 
				fill.chart = tm_chart_donut())

tm_shape(World) + 
	tm_polygons("HPI", 
				fill.scale = tm_scale_intervals(), 
				fill.chart = tm_chart_box())

tm_shape(World) + 
	tm_polygons("HPI", 
				fill.scale = tm_scale_intervals(), 
				fill.chart = tm_chart_violin())

# with additional ggplot2 code
require(ggplot2)
tm_shape(World) + 
	tm_polygons("HPI", 
				fill.scale = tm_scale_intervals(), 
				fill.chart = tm_chart_bar(
					extra.ggplot2 = theme(
						panel.grid.major.y = element_line(colour = "red")
					))
				)

tm_shape(land) +
	tm_raster("trees",
			  col.chart = tm_chart_histogram())

## categorical variable
tm_shape(World) + 
	tm_polygons("economy", 
				fill.scale = tm_scale_categorical(), 
				fill.chart = tm_chart_bar())

tm_shape(World) + 
	tm_polygons("economy", 
				fill.scale = tm_scale_categorical(), 
				fill.chart = tm_chart_donut())

tm_shape(World) +
	tm_polygons(tm_vars(c("HPI", "well_being"), multivariate = TRUE),
				fill.chart = tm_chart_heatmap())


}
