Skip to content

Instantly share code, notes, and snippets.

@mribeirodantas
Last active April 6, 2020 18:13
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 mribeirodantas/fccf45f75792ee4e746b11ba7a358880 to your computer and use it in GitHub Desktop.
Save mribeirodantas/fccf45f75792ee4e746b11ba7a358880 to your computer and use it in GitHub Desktop.
ggplot(df, aes(x=growth_rate_casos, y=retail_and_recreation,size=pop,color=dens_demo)) +
geom_point(shape=19) +
geom_smooth() +
scale_color_gradient(name = "Densidade\ndemográfica", low="blue", high="red",
labels = c('100 hab/km²',
'200 hab/km²',
'300 hab/km²',
'400 hab/km²',
'500 hab/km²')) +
scale_size_continuous(name = "População", labels = c('1 milhão hab',
'10 milhões hab',
'20 milhões hab',
'30 milhões hab',
'40 milhões hab',
'50 milhões hab')) +
xlab('Taxa de crescimento médio de número de casos por dia desde o primeiro caso confirmado') +
ylab('Variação de mobilidade para fins de\n lazer e varejo') +
labs(caption = "Ribeiro-Dantas, MC. April, 2020. mribeirodantas.xyz/blog") +
scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
scale_x_continuous(labels = function(x) paste0(sprintf("%0.0f", x), '%')) +
ggtitle("Taxa média diária de casos novos e deslocamento") +
ggrepel::geom_label_repel(aes(label = df$estado), size=3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment