#======
#Author: JA
#Date: 6/6/21
#======
#0
getwd()
pacman::p_load(
tidyverse,
plotly,
gganimate,
gifski,
devtools
)
devtools::install_github("thomasp85/tweenr")
devtools::install_github("thomasp85/transformr")
#ffmpeg
#1
temperaturas <- read_csv("temperaturas_globales.csv")
#2
#3
plot <- ggplot(temperaturas,aes(x=year,y=value)) +
geom_line() +
geom_point(
aes(fill=value),
size=5,
shape=21
) +
scale_x_continuous(
limits=c(1880,2017)
) +
scale_y_continuous(
limits=c(-0.5,1)
) +
scale_fill_distiller(
palette="RdYlBu",
limits=c(-1,1)
)
plotReveal <- plot + transition_reveal(
id=1,
along=year
)
plotTime <- plot + transition_time(
year
)
animate(
plotReveal,
width=600,
height=800,
fps=24,
renderer=ffmpeg_renderer()
)
anim_save("temperaturas_reveal.mp4")
animate(
plotTime,
width=600,
height=800,
fps=24,
renderer=gifski_renderer()
)
anim_save("temperaturas_time.gif")
Comments
0 B
|0 👍
/0 👎
0 B
|👍
/👎