Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library("ggplot2")
library("mxmaps")
df_mxmunicipio$value <- as.factor(sample(letters[1:2], 2457, replace = TRUE) )
df_mxmunicipio$value <- factor(df_mxmunicipio$value, levels = c("a", "b",
"c", "d"))
gg = MXMunicipioChoropleth$new(df_mxmunicipio)
gg$title <- "Municipios a and b"
gg$set_num_colors(4)
gg$ggplot_scale <- scale_fill_manual("type",
values = c("red", "blue", "green", "yellow"),
breaks = c("a", "b", "c", "d"),
drop = FALSE)
p <- gg$render()
p + theme_void()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment