R语言R数据可视化

R语言好玩包之gganimate

2018-06-09  本文已影响36人  热衷组培的二货潜

今天凌晨在逛twitter的时候,无意中看到了gganimate这个包,看到了以动图来展示数据,当时就觉得非常神器,于是一来到实验室就打开R开始实践这个包。

library(devtools)
install_github("dgrtwo/gganimate") 
# 报错Skipping install of 'gganimate' from a github remote, the SHA1 (bf820020) has not changed since last install.Use `force = TRUE` to force installation
# 于是使用提示来强制安装
install_github("dgrtwo/gganimate",force = TRUE)
# OK,可以愉快的玩耍了。
library(gapminder) ## 加载数据
library(ggplot2) 
theme_set(theme_bw())
p <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, color = continent, frame = year)) +
  geom_point() +
  scale_x_log10()
library(gganimate)
gganimate(p)
## 发现报错
I cannot find ImageMagick with convert = "convert"
Error in file(file, "rb") : cannot open the connection
In addition: Warning messages:
1: running command 'C:\WINDOWS\system32\cmd.exe /c convert --version' had status 4 
2: In find_magic() : ImageMagick not installed yet!
3: In im.convert(img.files, output = path.expand(movie.name), convert = convert,  :
  Please install ImageMagick first or put its bin path into the system PATH variable
4: In file(file, "rb") :
  cannot open file 'C:\Users\ql\AppData\Local\Temp\RtmpEroZjB/gganimate\file104c3b372ba8.gif': No such file or directory
# 仔细查看报错内容就可以知道本地缺少 'ImageMagick' 这个软件
gganimate(p)
上一篇下一篇

猜你喜欢

热点阅读