library("mxmaps")
data("df_mxstate_2020")
df_mxstate_2020$value = df_mxstate_2020$afromexican / df_mxstate_2020$pop * 100
mxhexbin_choropleth(df_mxstate_2020, num_colors = 1,
title = "Percentage of the population that identifies as Afro-Mexican",
legend = "%")
You can use label_color
if you want the state abbreviations in a different color than the default black, and you can also add a shadow_color
if you want to the state abbreviation labels to have a shadow to better distinguish them from the background colors.
library("viridis")
library("scales")
df_mxstate_2020$value = df_mxstate_2020$afromexican / df_mxstate_2020$pop
# Will show a warning, look at the municipio examples to see how to remove it
mxhexbin_choropleth(df_mxstate_2020,
num_colors = 1,
label_color = "white",
shadow_color = "black",
title = "Percentage of the population that identifies as Afro-Mexican",
legend = "%",
label_size = 3.8) +
scale_fill_viridis("percentage", labels = percent)