5

I must render some animations using gganimate but the images are not good looking. They lack definition and borders are pixelated. Is there any way of getting better results in windows 10?

My code is:

library(gapminder)
library(ggplot2)
library(gganimate)
Cairo(600, 600, file="plot.png", type="png", bg="white")
ggplot(gapminder,aes(gdpPercap, lifeExp, size = pop, colour = country)) +
  geom_point(alpha = 0.7, show.legend = FALSE) +
  scale_colour_manual(values = country_colors) +
  scale_size(range = c(2, 12)) +
  scale_x_log10() +
  facet_wrap(~continent) +
  # Here comes the gganimate specific bits
  labs(title = 'Year: {frame_time}', x = 'GDP per capita', y = 'life expectancy') +
  transition_time(year) +
  ease_aes('linear')

What I get is this:

enter image description here

Forge
  • 1,587
  • 1
  • 15
  • 36

1 Answers1

4

You can modify the default resolution with options()

options(gganimate.dev_args = list(width = 5, height = 7, units = 'in', res=320))
Andres
  • 2,413
  • 1
  • 13
  • 18
  • Changing the resolution seems to change the size of everything in the plot. Am I doing something wrong? – randy Mar 14 '22 at 21:01