inst/doc/b-state-choropleth.R

## ----message=FALSE------------------------------------------------------------
library(choroplethr)

?df_pop_state
data(df_pop_state)

?state_choropleth
state_choropleth(df_pop_state)

## -----------------------------------------------------------------------------
library(choroplethrMaps)

?state.regions
data(state.regions)
head(state.regions)

## -----------------------------------------------------------------------------
state_choropleth(df_pop_state,
                 title      = "2012 Population Estimates",
                 legend     = "Population",
                 num_colors = 1,
                 zoom       = c("california", "washington", "oregon"))

## -----------------------------------------------------------------------------
library(ggplot2)

?df_president 
data(df_president)

choro = StateChoropleth$new(df_president)
choro$title = "2012 Election Results"
choro$ggplot_scale = scale_fill_manual(name="Candidate", values=c("blue", "red"), drop=FALSE)
choro$render()

Try the choroplethr package in your browser

Any scripts or data that you put into this service are public.

choroplethr documentation built on July 9, 2023, 5:35 p.m.