[英]'animation' package in R saves GIF with status 127
我正在嘗試在Windows 7計算機的RStudio 0.98.1102中使用R 3.1.3的“動畫”包。 我已經安裝了ImageMagick,如果我寫了以下幾行,就會得到一個動畫的gif文件。
library(animation)
ani.options('C:/Program Files/ImageMagick-7.0.4-Q16/convert.exe')
png(file="example%02d.png",width=200, height=200)
for(i in c(10:1,"GO!")){
plot.new()
text(.5,.5,i,cex=6)
}
dev.off()
system("magick -delay 80 *.png example_1.gif")
到現在為止還挺好。 但是,當我嘗試使用gganimate軟件包時會遇到問題。 我剛剛從動畫包的github頁面復制了以下幾行:
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)
執行最后一行后,出現以下錯誤:
現在,我編寫以下命令,然后再次運行以獲取類似的錯誤消息,並且不會生成gif文件:
ani.options(convert = shQuote('C:/Program Files/ImageMagick-7.0.4-
Q16/magick.exe'))
gganimate(p)
現在,如果我寫下面的代碼行,則會收到錯誤消息,但會生成一個動畫gif文件。
ani.options(convert = shQuote('C:/Program Files/ImageMagick-7.0.4-
Q16/magick.exe'))
gganimate(p, "output.gif")
該動畫未在RStudio中顯示,我必須找到保存新gif文件的工作目錄的位置。
我不明白為什么會這樣,以及如何使用gganimate()生成.gif(在RStudio內部)而沒有生成任何錯誤消息。 非常感謝您對上述問題的反饋,建議和解決方案。
該代碼對我有用。 您安裝了ImageMagick嗎? gganimate
需要它,請參見此處以獲取指示: https : gganimate
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.