mxstate_choropleth: Create a state-level choropleth

Description Usage Arguments Examples

View source: R/state.R

Description

The map used is mxstate.map in the mxmapsData package. See mxstate.map for an object which can help you coerce your regions into the required format.

Usage

1
2
mxstate_choropleth(df, title = "", legend = "", num_colors = 7,
  zoom = NULL)

Arguments

df

A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?country.map.

title

An optional title for the map.

legend

An optional name for the legend.

num_colors

The number of colors to use on the map. A value of 1 will use a continuous scale, and a value in [2, 9] will use that many colors.

zoom

An optional vector of countries to zoom in on. Elements of this vector must exactly match the names of countries as they appear in the "region" column of ?country.regions

Examples

1
2
3
df <- df_mxstate
df$value <- df$indigenous
mxstate_choropleth(df)

diegovalle/mxmaps documentation built on July 16, 2017, 6:14 p.m.