R语言绘制gif动图
生活随笔
收集整理的這篇文章主要介紹了
R语言绘制gif动图
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
gapminder是我們要用到的數(shù)據(jù),用gganimate來繪制gif動圖
install.packages("gapminder") install.packages("gganimate") library(gapminder) library(gganimate) ggplot(gapminder,aes(gdpPercap,lifeExp,size=pop,colour=continent))+geom_point(alpha=0.7,show.legend = F)+#設(shè)置透明度scale_x_log10()+#對y取lg的對數(shù)scale_size(range=c(2,12))+facet_wrap(~continent)+#圖形分面#這是制作動畫的部分transition_time(year)+labs(title="Year:{frame_time}",x="GDP per capita",y="life expecttancy")+ease_aes("linear") anim_save('123.gif')#保存文件
如果有問題請?jiān)谠u論區(qū)回復(fù)
總結(jié)
以上是生活随笔為你收集整理的R语言绘制gif动图的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: kof'97 出招表
- 下一篇: 软考软件设计师中级考试大纲(附题型举例)