Skip to contents

An R6 object for creating municipio-level choropleths.

Value

An R6 Class

Super class

Choropleth2 -> MXMunicipioChoropleth

Public fields

show_states

boolean, draw state borders

Methods

Inherited methods


MXMunicipioChoropleth$render()

Render the map of Mexico

Usage

MXMunicipioChoropleth$render()

Returns

A new ggplot2 object with a map of Mexico.


MXMunicipioChoropleth$new()

Initialize the map of Mexico

Usage

Arguments

user.df

df

Returns

A new `MXMunicipioChoropleth` object.


MXMunicipioChoropleth$clone()

The objects of this class are cloneable with this method.

Usage

MXMunicipioChoropleth$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(viridis)
library(scales)

df_mxmunicipio_2020$value <- df_mxmunicipio_2020$indigenous_language /
                             df_mxmunicipio_2020$pop
gg <- MXMunicipioChoropleth$new(df_mxmunicipio_2020)
gg$title <- "Percentage of the population that self-identifies as indigenous"
gg$set_num_colors(1)
gg$ggplot_scale <- scale_fill_viridis("percent", labels = percent)
gg$render()