2
I’m trying to plot a graph of cases per state with geom_density_ridges
package ggridges
, to stay that way:
But by plotting the graph, it’s getting that way, all with the same line:
What am I doing wrong? Code I’m using:
library(tidyverse)
library(ggridges)
library(openxlsx)
library(lubridate)
url <- httr::GET("https://xx9p7hp1p7.execute-api.us-east-1.amazonaws.com/prod/PortalGeral",
httr::add_headers("X-Parse-Application-Id" =
"unAFkcaNDeXajurGB7LChj8SgQYS2ptm")) %>%
httr::content() %>%
'[['("results") %>%
'[['(1) %>%
'[['("arquivo") %>%
'[['("url")
ms <- read.xlsx(url) %>%
filter(is.na(municipio))
ms$data <- as_date(ms$data)
for(i in 9:14) {
ms[,i] <- as.numeric(ms[,i])
}
rm(url, i)
ms %>%
filter(data >= "2020-03-15", !is.na(estado)) %>%
ggplot(aes(x = data, y = estado, heigth = casosNovos)) +
geom_density_ridges(fill = "lightblue")
Thank you! It worked perfectly, has how I highlight the fashion instead of the median in the graphics and add a
trim = TRUE
to cut data on last available data?– Alexandre Sanches
You are welcome! I believe so, but I think it will be a good job, check this link. As to the
trim
, see this other link.– bbiasi
Thanks for the tips!
– Alexandre Sanches