Skip to content

Instantly share code, notes, and snippets.

@diegovalle
Created April 20, 2020 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegovalle/64303aa8525274f440856f435942e06e to your computer and use it in GitHub Desktop.
Save diegovalle/64303aa8525274f440856f435942e06e to your computer and use it in GitHub Desktop.
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