2017-08-13 23 views
1

パッケージ 'animation'にsaveGIF関数を使用しようとしていました。必要な外部ソフトウェアImageMagickをインストールしました。次のようにトライアルコードは次のとおりです。saveGIFを使用してRでアニメーションを作成

library(animation) 

ani.options(convert = 'C:\\Program Files\\ImageMagick-7.0.6-Q16\\convert.exe') 
saveGIF({ 
    for (i in 1:10) plot(runif(10), ylim = 0:1) 
}) 

をしかし、それは次のエラー得られます?

Executing: 
"C:\Program Files\ImageMagick-7.0.6-Q16\convert.exe -loop 0 -delay 100 
    Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png 
    Rplot8.png Rplot9.png Rplot10.png "animation.gif"" 
'C:\Program' is not recognized as an internal or external command, 
operable program or batch file. 
an error occurred in the conversion... see Notes in ?im.convert 
Warning messages: 
1: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Program Files\ImageMagick-7.0.6-Q16\convert.exe -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif""' had status 1 
2: In cmd.fun(convert) : 
    '"C:\Program Files\ImageMagick-7.0.6-Q16\convert.exe -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif""' execution failed with error code 1 
3: running command '"C:\Program Files\ImageMagick-7.0.6-Q16\convert.exe -loop 0 -delay 100 Rplot1.png Rplot2.png Rplot3.png Rplot4.png Rplot5.png Rplot6.png Rplot7.png Rplot8.png Rplot9.png Rplot10.png "animation.gif""' had status 127 

ノートからメモを

ImageMagick users Please install ImageMagick from http://www.imagemagick.org , and make sure the the path to convert.exe is in your 'PATH' variable, in which case the commandconvert can be called without the full path. Windows users are often very confused about the ImageMagick and 'PATH' setting, so I'll try to search for ImageMagick in the Registry Hive by readRegistry('SOFTWARE\ImageMagick\Current')$BinPath, thus you might not really need to modify your 'PATH' variable. For Windows users who have installed LyX, I will also try to find the convert utility in the LyX installation directory, so they do not really have to install ImageMagick if LyX exists in their system (of course, the LyX should be installed with ImageMagick). Once the convert utility is found, the animation option 'convert' will be set (ani.options(convert = 'path/to/convert.exe')); this can save time for searching for convert in the operating system next time.

が、それは間違っている私ですim.convert convert.exeへのパスがPATH変数にない場合、convert.exeに完全なdirを指定する必要があるということを理解できますか?

設定に何か問題がありますかconvert.exeを呼びますか?

+0

あなたのコードは、 'C:\\ Program Files \\ ImageMagick-7.0.6-Q16 \\ convert.exe'というパスが正しいかどうかを慎重にチェックしてください。 –

+0

私はLinux上にいるので、これをテストすることはできませんが、Windowsではスペースを含むパスを引用符で囲む必要があると思います。 '' Ani.options(convert = "'C:\\ Program Files \\ ImageMagick-7.0.6-Q16 \\ convert.exe'") ' – dww

+0

Marco Sandri、はい、convert.exeへのこのパスは本当に正しいです。これもデフォルトのインストールディレクトリです。 – Gamp

答えて

-1
saveGIF({ 

    for (i in dflaser10sec1$seg) { 

    title <- as.character(i) 

    g1 <- ggplot(dflaser10sec1, aes(x = dflaser10sec1$value, y = dflaser10sec1$pos, fill = dflaser10sec1$pos, width = 1)) + 
     coord_fixed() + 
     coord_flip() + 
     annotate('text', x = 98, y = -800000, 
       label = 'Laser PROFILE', size = 3) + 
     geom_bar(data = subset(dflaser10sec1, pos == "9"), stat = "identity") + 
     geom_bar(data = subset(dflaser10sec1, pos == "10"), stat = "identity") + 
     theme_economist(base_size = 14) + 
     scale_fill_manual(values = c('#ff9896', '#d62728')) + 
     ggtitle(paste0('profile of the laser setup, ', title)) + 
     ylab('Value') + 
     xlab('Laser Position') + 
     theme(legend.position = "bottom", legend.title = element_blank()) + 
     guides(fill = guide_legend(reverse = TRUE)) 

    print(g1) 

    } 

}, movie.name = 'laser.gif', interval = 0.1, ani.width = 700, ani.height = 600) 
+0

しかし、結果のエラー – APD

+0

エラー:美学は長さ1またはデータ(1436)と同じでなければなりません:x、y、塗りつぶし、幅 さらに:警告メッセージ: 1: 'panel.margin'は推奨されません。代わりに 'panel.spacing'プロパティを使用してください 2:' legend.margin'は 'margin()'を使って指定する必要があります。古い動作ではlegend.spacingを使用します。 – APD

関連する問題