ggChoropleth: Draw an interactive choropleth map

Description Usage Arguments Examples

View source: R/ggChoropleth.R

Description

Draw an interactive choropleth map

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#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)

Example output



ggiraphExtra documentation built on Oct. 23, 2020, 7:39 p.m.