Error: animation of gg objects not supported

Hi, I am trying to animate a line graph using the animate () feature but I keep getting the error of animation of gg objects not supported. I am able to create an animated line graph using transition_reveal, but the dimensions of the graph come out weird and grainy.

Here is my code:
graph <- ggplot(mydata, aes(x = birds, y = cost)) +
geom_line(color = "green") +
scale_x_reverse (breaks = c(100, 95, 90, 85, 80, 75, 70, 65, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 10, 5, 0)) +
scale_y_continuous (breaks = c(0.00, 0.50, 1.00, 1.50, 2.00, 2.50, 3.00)) +
labs(x = "Birds)",
y = "Cost",
title = "Cost of birds")

Thank you!

Hi, can you provide a reproducible example of your dataset mydata?

What code did you use for the transition?

The dataset mydata is an excel file with two columns for the data (the birds is 100-0 in one column and the cost is various values in another column).

I used readxl to connect the excel file to my r studio.

For the transition, I made my static graph and used transition_reveal
graph + transition_reveal(birds, range = c(100,0), keep_last = FALSE) +
anim_save("qfixed", animation = last_animation())

This worked, but I'm unable to change the dimensions and quality of the graph. I also want to stop the graph from animating after it circles once, but am unable to do so.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.