1
I have a bar graph on the R made with the function geom_col
. I would like to decrease the border size, because it is not showing the chart fill. I tried using the argument width
, but is only changing the size of the padding and has not solved the problem.
How’s the chart coming along:
Code I am using:
suppressPackageStartupMessages({
library(tidyverse)
library(zoo)
})
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")
dados <- utils::read.csv2(url, stringsAsFactors = FALSE, fileEncoding = "latin1")
dados$data <- lubridate::as_date(dados$data)
dados <- dados %>%
filter(data > as.Date("2020-02-29"))
rm(url)
dados %>%
mutate(mm7dCasos = rollmean(casosNovos, 7, fill = list(NA, NULL, NA), align = "right")) %>%
filter(data > "2020-03-14") %>%
ggplot() +
geom_col(aes(x = data, y = casosNovos), na.rm = TRUE, color = "black", fill = "white", width = 0.75) +
geom_line(aes(x = data, y = mm7dCasos), colour = "#FF6347", size = 0.4) +
labs(x = "", y = "") +
ggtitle("Variação diária de novos casos confirmados - Brasil", "(MM7d)") +
coord_cartesian(ylim = c(0, 1000)) +
scale_x_date(date_labels = "%b %d", date_breaks = "2 week") +
theme(text = element_text(size = 10), axis.text.x = element_text(angle = 45, hjust = 1)) +
facet_wrap(~estado, nrow = 3)
Unable to find "rollmean"
– Tomás Barcellos
Sorry, the package was pre-loaded in my R, already includes it in the code.
– Alexandre Sanches
Have you seen the result remove
color
ofgeom_col
?– Rui Barradas
If I remove the
color
, theggplot2
only leaves without the edge.– Alexandre Sanches
Try to change the argument
size
in thegeom_col
– Jorge Mendes