Adam Marín
Adam Marín

Reputation: 21

Animated graph in Rstudio desktop with gganimate does not work in Kaggle

I am new in R and Kaggle, I made a graph in R and it works, I tried to run it in Kaggle but it does not work, Kaggle does not give me an error or reason. I tried to run it and then nothing cames up, I do not understand what is happening. If I run the graph without gganimate it works, but if I put function "transition_time(Date)" it does not work, same thing if I add "animate" function.

I searched in internet if someone else had same or similar problem, but I found a few users that run gganimate without problem. they got an outcome from Kaggel. I followed their steps and got no result.

I expected same result as I got in Rstudio.

`p <- ggplot(data = Minute_sleep_merged, mapping = aes(x = Time, y = N, 
group = Date,     colour = factor(Value))) +
geom_point(size = 3, alpha = 0.5, shape = 15) +
scale_color_manual(name = "Values", values = c("aliceblue", 
"cornflowerblue", "black")) +
labs(title = "Sleep levels through time per day: {frame_time}", x = "Time", 
y = "User") + 
theme(legend.position = "right",
    panel.background = element_rect(fill = "white", color = "white"),
    panel.grid.major = element_line(color = "antiquewhite2", linetype = "twodash"),
    panel.grid.minor = element_line(linetype = "blank"),
    panel.grid.major.x = element_line(colour = "antiquewhite2", linetype = "twodash"),
    panel.grid.minor.x = element_line(linetype = "blank"),
    axis.ticks = element_blank()) +
scale_x_time(name = "Time", labels = label_time(format = "%H"),
breaks =   as_hms(c("00:00:00","01:00:00","02:00:00","03:00:00","04:00:00","05:00:00",
"06:00:00","07:00:00","08:00:00","09:00:00","10:00:00","11:00:00","12:00:00",
"13:00:00","14:00:00","15:00:00","16:00:00","17:00:00","18:00:00","19:00:00",
"20:00:00","21:00:00","22:00:00","23:00:00","24:00:00"))) +
scale_y_continuous(name = "User", breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)) +
transition_time(Date)

animate(p, duration = 64)`

Upvotes: 1

Views: 23

Answers (0)

Related Questions