I'm having trouble creating high resolution files when using gganimate
. The text in the charts comes out blurry, almost as if the text is being written for every new frame in the .gif
.
Is there a simple solution to this problem? I tried fiddling with the ani.options()
, but haven't had any luck there either.
Example data and code:
value <- sample(0:30, 300, replace = TRUE)
year <- rep(c(2000, 2001, 2002), 100)
df <- as.data.frame(cbind(value, year))
library(gganimate)
library(tidyverse)
df <- df %>% group_by(year) %>% mutate(avg.value = mean(value))
p <- df %>%
ggplot(aes(x = value)) +
geom_histogram(position = 'identity', color = "white") +
geom_segment(aes(xend = avg.value, x = avg.value, y = 0, yend = -.5),
color = "red", size = 2.5) +
transition_states(as.factor(year), transition_length = 2, state_length
= 1, wrap = TRUE) +
annotate("text", x = df$avg.value, y = -1, label = "Average") +
labs(x = " ",
y = "",
title = "Example chart",
subtitle = "Don't it look blurry?")
animate(p, nframes = 100, renderer = gifski_renderer("example.gif"))