Created
June 20, 2021 13:27
-
-
Save fernandobarbalho/f77d4f5518d898c6dea6a0bc969e00ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readr) | |
library(geobr) | |
#O arquivo csv abaixo foi gerado a partir de uma consluta SQL do Big Query provido pela Base dos dados. | |
#Saiba mais sobre base dos dados em https://basedosdados.org/ | |
#A consulta SQL exceutada no big query é essa: | |
#SELECT * | |
#FROM `basedosdados.br_ibge_populacao.municipio` | |
#where ano = 2020 | |
populacao_municipios <- read_csv("populacao_municipios.csv") | |
map_br <- geobr::read_municipal_seat () | |
populacao_municipios<- | |
populacao_municipios %>% | |
rename(code_muni = id_municipio) %>% | |
mutate(menor_que_500k = ifelse(populacao<500000,1,0)) | |
map_br %>% | |
inner_join(populacao_municipios %>% | |
filter(menor_que_500k == TRUE) | |
) %>% | |
ggplot() + | |
geom_sf(color= "black", fill=NA, show.legend = FALSE,alpha =1)+ | |
geom_sf(data = map_br %>% | |
inner_join(populacao_municipios %>% | |
filter(menor_que_500k == FALSE) | |
), color= "red", fill=NA, show.legend = FALSE,alpha =1, size=1)+ | |
#scale_color_manual(c("black", "red")) + | |
theme_minimal() + | |
theme( | |
axis.text = element_blank(), | |
panel.background = element_rect(fill = "white", color = "white"), | |
panel.border = element_blank(), | |
panel.grid = element_blank() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment