ggChoropleth {ggiraphExtra}R Documentation

Draw an interactive choropleth map

Description

Draw an interactive choropleth map

Usage

ggChoropleth(
  data,
  mapping,
  map,
  palette = "OrRd",
  reverse = FALSE,
  color = "grey50",
  title = "",
  digits = 1,
  interactive = FALSE,
  ...
)

Arguments

data

a data.frame

mapping

Set of aesthetic mappings created by aes or aes_. Passed on geom_map_interactive. Required mappings are map_id and fill. Possible mapping is facet.

map

a map maybe a result of map_data()

palette

A palette name used for discrete fill var, Default value is "OrRd"

reverse

If true, reverse palette colors

color

A name of color of polygon, Default value is "grey50"

title

A title

digits

An integer indicating the number of decimal places

interactive

Logical. If positive an interactive map will be made

...

other arguments passed on to geom_map_interactive

Examples

#crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
#require(ggplot2)
#require(ggiraph)
#require(maps)
#require(mapproj)
#require(reshape2)
#require(RColorBrewer)
#states_map <- map_data("state")
#ggChoropleth(crimes,aes(fill=Murder,map_id=state),map=states_map,interactive=TRUE)
#ggChoropleth(crimes,aes(fill=c(Murder,Rape),map_id=state),map=states_map,interactive=TRUE)
#ggChoropleth(crimes,aes(map_id=state),map=states_map,palette="OrRd",interactive=TRUE)

[Package ggiraphExtra version 0.3.0 Index]