% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/map.R
\name{e_map}
\alias{e_map}
\alias{e_map_}
\alias{e_map_3d}
\alias{e_map_3d_}
\alias{e_map_3d_custom}
\title{Choropleth}
\usage{
e_map(e, serie, map = "world", name = NULL, rm_x = TRUE,
  rm_y = TRUE, ...)

e_map_(e, serie = NULL, map = "world", name = NULL, rm_x = TRUE,
  rm_y = TRUE, ...)

e_map_3d(e, serie, map = "world", name = NULL, coord_system = NULL,
  rm_x = TRUE, rm_y = TRUE, ...)

e_map_3d_(e, serie = NULL, map = "world", name = NULL,
  coord_system = NULL, rm_x = TRUE, rm_y = TRUE, ...)

e_map_3d_custom(e, id, value, height, map = NULL, name = NULL,
  rm_x = TRUE, rm_y = TRUE, ...)
}
\arguments{
\item{e}{An \code{echarts4r} object as returned by \code{\link{e_charts}}.}

\item{serie}{Values to plot.}

\item{map}{Map type.}

\item{name}{name of the serie.}

\item{rm_x, rm_y}{Whether to remove x and y axis, defaults to \code{TRUE}.}

\item{...}{Any other option to pass, check See Also section.}

\item{coord_system}{Coordinate system to use, one of \code{cartesian3D}, \code{geo3D}, \code{globe}.}

\item{id, value, height}{Columns corresponding to registered map.}
}
\description{
Draw maps.
}
\examples{
\dontrun{
choropleth <- data.frame(
  countries = c("France", "Brazil", "China", "Russia", "Canada", "India", "United States",
                "Argentina", "Australia"),
  values = round(runif(9, 10, 25))
)

choropleth \%>\% 
  e_charts(countries) \%>\% 
  e_map(values) \%>\% 
  e_visual_map(min = 10, max = 25)

choropleth \%>\% 
  e_charts(countries) \%>\% 
  e_map_3d(values, shading = "lambert") \%>\% 
  e_visual_map(min = 10, max = 30)
        
# custom
buildings <- jsonlite::read_json(
  paste0(
    "https://ecomfe.github.io/echarts-examples/",
    "public/data-gl/asset/data/buildings.json"
  )
)

heights <- purrr::map(buildings$features, "properties") \%>\% 
  purrr::map("height") \%>\% 
  unlist()
  
names <- purrr::map(buildings$features, "properties") \%>\% 
  purrr::map("name") \%>\% 
  unlist()
  
data <- dplyr::tibble(
  name = names,
  value = round(runif(length(names), 0, 1), 6),
  height = heights / 10
)

data \%>\% 
  e_charts() \%>\% 
  e_map_register("buildings", buildings) \%>\%
  e_map_3d_custom(name, value, height) \%>\% 
  e_visual_map(
    show = FALSE,
    min = 0.4,
    max = 1
  ) 
  
# timeline
choropleth <- data.frame(
    countries = rep(choropleth$countries, 3)
  ) \%>\% 
  dplyr::mutate(
    grp = c(
      rep(2016, nrow(choropleth)),
      rep(2017, nrow(choropleth)),
      rep(2018, nrow(choropleth))
    ),
    values = runif(27, 1, 10)
  )
  
choropleth \%>\% 
  group_by(grp) \%>\% 
  e_charts(countries, timeline = TRUE) \%>\% 
  e_map(values) \%>\% 
  e_visual_map(min = 1, max = 10)
  
choropleth \%>\% 
  group_by(grp) \%>\% 
  e_charts(countries, timeline = TRUE) \%>\% 
  e_map_3d(values) \%>\% 
  e_visual_map(min = 1, max = 10)
}

}
\seealso{
\code{\link{e_country_names}}, 
\href{Additional map arguments}{https://ecomfe.github.io/echarts-doc/public/en/option.html#series-map}, 
\href{Additional map 3D arguments}{http://echarts.baidu.com/option-gl.html#series-map3D}
}
