library(ggplot2)
library(gganimate)
DATASET IRIS
#1
ggplot(iris,
aes(x=Petal.Width,
y=Petal.Length))+
geom_point(aes(colour=Species,group=1L))+
labs(title="Iris Species by Petal Width and Sepal Length",
x="Petal Width",
y="Petal Length")+
transition_states(Species,
transition_length = 2,
state_length = 1)
#2
ggplot(iris,
aes(x=Petal.Width,
y=Petal.Length))+
geom_point(aes(colour=Species), size=2)+
labs(title="Iris Species by Petal Width and Sepal Length",
x="Petal Width",
y="Petal Length")+
transition_states(Species,
transition_length=2,
state_length=1)
#3
ggplot(iris,
aes(x=Petal.Width,
y=Petal.Length))+
geom_point(aes(colour=Species), size=2)+
labs(title="Iris Species by Petal Width and Sepal Length",
x="Petal Width",
y="Petal Length")+
transition_states(Species,
transition_length=2,
state_length=1) +
enter_fade() + enter_drift(x_mod=-1)+
exit_shrink() + exit_drift(x_mod=5)
DATASET MTCARS
ggplot(mtcars,
aes(x=factor(cyl),mpg))+
geom_boxplot()+
transition_states(
gear,
transition_length=2,
state_length = 1)+
enter_fade()+
exit_shrink()+
ease_aes('sine-in-out')
DATASET DATASAURUS
library(datasauRus)
ggplot(datasaurus_dozen, aes(x=x, y=y))+
geom_point()+
theme_minimal()+
transition_states(dataset, 3, 1)+
ease_aes('cubic-in-out')