An R6 object for creating state-level hexbin choropleths.
An R6 object for creating state-level hexbin choropleths.
Super class
mxmaps::Choropleth2 -> MXHexBinChoropleth
Public fields
label_colorcolor for the state labels
shadow_colorshadow color for the state labels
label_sizefont size for the state labels
show_labelsdraw the state labels
auto_contrastautomatically determine the label color based on the map fill scale
Methods
Inherited methods
mxmaps::Choropleth2$bind()mxmaps::Choropleth2$clip()mxmaps::Choropleth2$discretize()mxmaps::Choropleth2$format_levels()mxmaps::Choropleth2$get_bounding_box()mxmaps::Choropleth2$get_choropleth_as_polygon()mxmaps::Choropleth2$get_max_lat()mxmaps::Choropleth2$get_max_long()mxmaps::Choropleth2$get_min_lat()mxmaps::Choropleth2$get_min_long()mxmaps::Choropleth2$get_reference_map()mxmaps::Choropleth2$get_scale()mxmaps::Choropleth2$get_x_scale()mxmaps::Choropleth2$get_y_scale()mxmaps::Choropleth2$get_zoom()mxmaps::Choropleth2$prepare_map()mxmaps::Choropleth2$render_with_reference_map()mxmaps::Choropleth2$set_num_colors()mxmaps::Choropleth2$set_zoom()mxmaps::Choropleth2$theme_clean()mxmaps::Choropleth2$theme_inset()
Examples
library(viridis)
#> Loading required package: viridisLite
library(scales)
#>
#> Attaching package: ‘scales’
#> The following object is masked from ‘package:viridis’:
#>
#> viridis_pal
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()