Взгляните на [enter/exit() functions][1]
в gganimate
Я думаю, вы хотите что-то вроде:
p <- ggplot() +
geom_point(data = df1, aes(x=SpotPriceEUR, y = PriceArea, colour = SpotPriceEUR,size=2),show.legend=FALSE) +
geom_point(data = ag, aes(x=ag$x, y = ag$Group.1, size = 1, shape=8),color = "blue",show.legend=FALSE) +
scale_shape_identity() +
scale_colour_continuous(low = "green", high = "red",guide = "colourbar") +
transition_time(Hour) +
scale_alpha(range = c(0,1)) +
guides(alpha = F) +
theme_minimal() +
labs(title = "Date: {frame_time}",x = "Spot Price [EUR]",y = "Price Area") +
exit_fade()
Чтобы добавить немного случайных изменений вдоль оси y, вы ' Я хочу использовать geom_jitter (). Попробуйте это:
p <- ggplot() +
geom_jitter(data = df1, aes(x=SpotPriceEUR, y = PriceArea, colour = SpotPriceEUR,size=2),show.legend=FALSE, width = 0, height = 0.25) +
geom_point(data = ag, aes(x=ag$x, y = ag$Group.1, size = 1, shape=8),color = "blue",show.legend=FALSE) +
scale_shape_identity() +
scale_colour_continuous(low = "green", high = "red",guide = "colourbar") +
transition_time(Hour) +
scale_alpha(range = c(0,1)) +
guides(alpha = F) +
theme_minimal() +
labs(title = "Date: {frame_time}",x = "Spot Price [EUR]",y = "Price Area") +
exit_fade()
Возможно, вам придется поиграться с параметром width / height в geom_jitter, чтобы получить именно то, что вам нужно.