1 Star 0 Fork 0

张剑/市场预测

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
aqianimate.R 981 Bytes
一键复制 编辑 原始数据 按行查看 历史
张剑 提交于 2020-03-20 11:27 . no message
library(haven)
library(tidyverse)
library(gganimate)
library(ggthemes)
library(ggfortify)
data <- read_dta("D:/github/forecast/data/data_0224.dta")
aqi<- data %>%
mutate(year = as.character(year),month = as.character(month),
day = as.character(day)) %>%
filter(year == 2020) %>%
mutate(month = str_pad(month,width = 2,pad = 0,side='left'),day = str_pad(day,width = 2,pad=0,side = 'left')) %>%
mutate(date = str_c(year,month,day,sep = '-')) %>%
select(-year,-month,-day) %>%
select(aqi,pm25,so2,no2,o3,co,city,date) %>%
drop_na() %>%
mutate(date = as.Date(date)) %>%
filter (city %in% c("成都",'海口','武汉'))
plot<-ggplot(aqi,mapping = aes(x=date,y=aqi,color=city)) +geom_line(size=1.3,alpha=0.6)+theme_clean()+
ggtitle('三个城市2020年aqi数据') +xlab('时间')+ylab('空气质量')+
transition_reveal(date)
animate(plot,
nframes = 200,
fps = 30)
anim_save('aqi.gif',path = 'D:/github/forecast/image')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/jefeerzhang/forcast.git
git@gitee.com:jefeerzhang/forcast.git
jefeerzhang
forcast
市场预测
master

搜索帮助