gganimate icon indicating copy to clipboard operation
gganimate copied to clipboard

geom_text in animation producing very bad font quality

Open neuwirthe opened this issue 3 years ago • 1 comments

When using geom_text to put labels on an animation, the labels are rendered in very bad quality. Is there a way to circumvent this problem?

The following piece of code and the attached gif file demonstrate the problem

suppressPackageStartupMessages({
  library(tidyverse)
  library(gganimate)
})

iris <- as_tibble(iris)
p <- ggplot(iris, aes(x = Petal.Width, y = Petal.Length)) + 
  geom_point() +
  geom_text(x=1.25,y=1.5,label="Species") 

plot(p)

anim <- p + 
  transition_states(Species,
                    transition_length = 2,
                    state_length = 1)
anim_save("geom_text_problem.gif")

geom_text_problem

neuwirthe avatar May 06 '22 12:05 neuwirthe

Using annotate instead of geom_text solves the problem.

neuwirthe avatar May 06 '22 13:05 neuwirthe