- Rで動画
- 掲載図のようなウェブページもできれば、以下のような動画埋め込みPDF(こちら)も
convert hoge.gif hoge.mpeg
library(animation)
library(fields)
library(caTools)
munit<-30
m = munit^2
C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ), imag=rep(seq(-1.2,1.2, length.out=m), m ) )
C = matrix(C,m,m)
Z =0.1
K<-20
X = array(0, c(m,m,K))
for (k in 1:K) {
Z = Z^2+C
X[,,k] = exp(-abs(Z))
}
oopt = ani.options(interval = 0.2, nmax = 10)
for(i in 1:length(X)){
image(X[,,i], col=tim.colors(256))
ani.pause()
}
ani.options(oopt)
saveHTML({
ani.options(interval = 0.05, nmax = 30)
par(mar = c(3, 3, 2, 0.5), mgp = c(2, 0.5, 0), tcl = -0.3,
cex.axis = 0.8, cex.lab = 0.8, cex.main = 1)
for(i in 1:K){
image(X[,,i], col=tim.colors(256))
ani.pause()
}
}
)
saveGIF({
ani.options(nmax = 30)
for(i in 1:K){
image(X[,,i], col=tim.colors(256))
ani.pause()
}
}
)
saveSWF({
par(mar = c(3, 2.5, 1, 0.2), pch = 20, mgp = c(1.5, 0.5,
0))
for(i in 1:K){
image(X[,,i], col=tim.colors(256))
ani.pause()
}
}, ani.dev = "pdf", ani.type = "pdf", swf.name = "buffon.swf",
interval = 0.1, nmax = 40, ani.height = 7, ani.width = 7)
saveLatex({
par(mar = c(3, 3, 1, 0.5), mgp = c(2, 0.5, 0), tcl = -0.3,
cex.axis = 0.8, cex.lab = 0.8, cex.main = 1)
for(i in 1:K){
image(X[,,i], col=tim.colors(256))
ani.pause()
}
}, img.name = "BM_plot", latex.filename = ifelse(interactive(),