I am trying to make an animated histogram with the following code:
library(ggpubr)
library(gganimate)
p <- gghistogram(df, x = "Idade", bins = 30,
add = "mean", rug = T,
color = "Género", fill = "Género",
palette = c("#0073C2FF", "#FC4E07", "grey"),
xlab ="Idade (anos)", ylab = "(n)",
title = "Distribuição de Idades") +
theme(legend.position = "right")+
theme_ipsum_rc(grid="Y",base_size = 16,axis_title_size = 14)+
transition_states(Idade, wrap = F) + shadow_mark() + enter_grow() + exit_fade()
animate(p, nframes=100, fps = 10, renderer = gifski_renderer(loop = FALSE))
but I am getting different darker blue and red bars (ghosts) like this:
I can't figure it out. Any ideas on how to remove the darker bars? Thanks!