Hello there, I wanted to animate my barplot but when I try to do so I always get the bars 'truncated' in the animation. This is because the png images show truncated bars and it is not due to the gif "compiler".
The data comes from this website --> https://www.kaggle.com/gregorut/videogamesales
Could you help me with this? Thank you!
library(ggplot2)
library(dplyr)
library(gganimate)
library(gifski)
vg = read.csv("yourpath/vgsales.csv")
vg$Year = as.numeric(vg$Year) #transform to numeric
vg = vg[!is.na(vg$Year),] #filter out NA rows
vg_3 = vg[vg$Publisher=='Nintendo',] #account only for Nintendo
#create an animation barplot
theme_set(
theme_bw() +
theme(legend.position = "top")
)
myplot = ggplot(vg_3, aes(x=Genre, y=Global_Sales, size = Global_Sales, color = Genre)) +
geom_point(alpha=0.5)+
scale_size(range = c(0.2, 11)) +
labs(title = 'Year: {frame_time}', x = 'Publishers', y = 'Sales') +
transition_time(Year) +
ease_aes('linear')
animate(myplot, duration = 9, fps = 25, width = 900, height = 700, renderer = gifski_renderer())
anim_save("output.gif")