Learn R Programming

ggiraphExtra (version 0.1.0)

ggChoropleth: Draw an interactive choropleth map

Description

Draw an interactive choropleth map

Usage

ggChoropleth(data, mapping, map, colors = c("white", "orange", "red"),
  palette = NULL, 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()

colors

A vector of colours used as a parameter of scale_fill_gradientn()

palette

A palette name used for discrete fill var

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

Run this code
# NOT RUN {
#crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
#require(ggplot2)
#require(ggiraph)
#require(maps)
#require(mapproj)
#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,interactive=TRUE)
# }

Run the code above in your browser using DataLab