Questions tagged [gganimate]

gganimate is a package for R that allows to produce animated graphics with ggplot2. It is based on the animation package.

gganimate is a package for R that allows to produce animated graphics with ggplot2. It is based on the animation package.

Repositories:

549 questions
2
votes
1 answer

Displaying data value in subtitle of gganimate plot [R]

Since I couldn't find a answer here a simplified version of my code and used data. My data contains a "days" variable, which represents the number of originally datapoints in this week. Using a gganimate plot, I can display the current week in the…
Hilk
  • 23
  • 4
2
votes
1 answer

How can I animate geom_bar to "add data" using a filter function?

Ok, we all know this is not my real data or question, but, for the sake of a reproducible example... Let's say that I'm trying to get enough flowers for my daughter's wedding. My friend Anna has 25 plants of each species in the iris dataset at her…
Nova
  • 5,423
  • 2
  • 42
  • 62
2
votes
1 answer

gganimate error with long-format data and plot_usmap

I'm trying to animate a map graph using gganimate but am running into the following error: Error in seq.default(range[1], range[2], length.out = nframes) : 'from' must be a finite number It seems like this usually occurs when the variable used for…
2
votes
1 answer

Arrow pointing wrong direction using gganimate

I have simple plot: sample_data <- data.frame( x = 1:100 , y = 1:100 ) temp_plot <- ggplot(sample_data , aes(x = x , y = y)) + geom_line( size = 3 , arrow = arrow() , lineend = "round" ,…
Mark Peterson
  • 9,370
  • 2
  • 25
  • 48
2
votes
1 answer

gganimate: two layers with different geometries and timepoints

The problem is similar to this question but here the two layers use different geometries, geom_tile and geom_point. The idea is to have tiles show up at different locations only in frames 2, 5, 8, and the point move along the diagonal in every…
mattek
  • 903
  • 1
  • 6
  • 18
2
votes
0 answers

How to tell gganimate to stop animating between large time periods when data is not present

I am using gganimate to plot animal movement tracks over time. The animal is only present at certain locations at certain times of year. I am using transition_states to animate across time with geom_points, however gganimate makes it appear as if…
user290891
  • 21
  • 1
2
votes
1 answer

gganimate independently geom_text and geom_point

I have a dataset of countries on a PC space. I would like to plot all points on this space (see image below). ggplot(ind_countries, aes(PC1, PC2)) + geom_point() I would like to show the name of the country only during the animation, and…
Matias Andina
  • 4,029
  • 4
  • 26
  • 58
2
votes
0 answers

How to show a change in axes and a change in rectangle dimensions using gganimate?

I am trying to make an animation that shows a couple of rectangles changing shape, while the plotting axes change simultaneously. In the code below I have specified only two data states for the data to transition between, yet there appear to be…
Sean Kross
  • 51
  • 2
2
votes
0 answers

Is it possible to change color backgrounds in time lapse with gganimate?

I'm trying to do a scatterplot similar to this one with gganimate in R: But I can't find any function to do what the legend in the plot added before does. Does anyone know how can I do a legend similar to that one? The time runs in the legend bar…
Mireia
  • 21
  • 4
2
votes
1 answer

Round the labels on bars of animated barplot in gganimate?

I want to round the labels on each corresponding bar. Currently when animation is in transition it show many decimal places: Data: mydf <- data.frame(TIME = c(2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2008L, 2010L, 2010L,…
2
votes
1 answer

Getting attempt to apply non-function when view_follow() is used in ggplot2

Getting "attempt to apply non-function" when view_follow() is used. It is working as expected when view_follow() function is removed. I am adding this to adjust y-axis basis for the value plotted on the axis. I appreciate a help. Reproducible code…
2
votes
1 answer

gganimate::transition_time results in flying polygons

Trying to create an animation with simple features, essentially a time series of a spatial variable in the form of choropleth maps. The issue is that the polygons fly all over the plot at the time of the animation. Here's a reproducible example,…
2
votes
1 answer

Animated bar chart using ggplot and gganiminate

I have a bar plot created with ggplot which I would like to animate; the basic plot is ... I have researched this on the web and created this code:- Here is some Reprex data ... Data <- as.data.frame(rbind(c("11 Mar'", "Male", "20-30"), …
Peter
  • 118
  • 9
2
votes
1 answer

Why does transition_layer in gganimate add an extra layer of NA? Can it be removed?

In generating a plot using transition_layer in gganimate, I noticed that an additional layer is added of NA. As a minimum example. Say I have 10 unique observations (labeled "obs") of x,y pairs for each of 5 groups (labeled…
Micky
  • 190
  • 11
2
votes
1 answer

Is there a way to animate a word cloud in R?

Currently, I am using the library("wordcloud") to make a word cloud of frequent terms some text data that I have. The text data also comes with an associated year, and I want to be able to generate new word clouds based on the year, and I want it to…
babycoder
  • 23
  • 3