MXHexBinChoropleth: An R6 object for creating state-level hexbin choropleths.

MXHexBinChoroplethR Documentation

An R6 object for creating state-level hexbin choropleths.

Description

An R6 object for creating state-level hexbin choropleths.

An R6 object for creating state-level hexbin choropleths.

Super class

choroplethr::Choropleth -> MXHexBinChoropleth

Public fields

label_color

color for the state labels

shadow_color

shadow color for the state labels

label_size

font size for the state labels

show_labels

draw the state labels

auto_constrast

automatically determine the label color based on the map fill scale

Active bindings

auto_constrast

automatically determine the label color based on the map fill scale

Methods

Public methods

Inherited methods

Method new()

Initialize the map of Mexico

Usage
MXHexBinChoropleth$new(user.df)
Arguments
user.df

df

Returns

A new 'MXHexBinChoropleth' object.


Method render()

Render a map of Mexico

Usage
MXHexBinChoropleth$render()
Returns

A ggplot2 object with the map of Mexico.


Method clone()

The objects of this class are cloneable with this method.

Usage
MXHexBinChoropleth$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

library(viridis)
library(scales)

df_mxstate$value <-  df_mxstate$indigenous / df_mxstate$pop
gg = MXHexBinChoropleth$new(df_mxstate)
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()

diegovalle/mxmaps documentation built on Sept. 22, 2023, 9:57 p.m.