贊助

Donate

搜尋此網誌

贊助本站

Donate

2017年11月7日 星期二

sin wave shift

Using R and PhotoScape to generate a shift sin wave animation

R code:
for (i in 1:30){
x=seq(-6*pi,-4*pi,by=.02)
y=sin(x)

png(paste0(i,".png"),width=640,height = 400)
plot(x+i,y,xlim=c(-3*pi,3*pi),type="l" ,ann=F,lwd=2,col="blue")

abline(h=0)
dev.off()
}


for(i in 1:30) file.copy(from=paste0(getwd(),"/",i,".png"),to=paste0(getwd(),"/",61-i,".png"),overwrite = T)




沒有留言:

張貼留言

C3 plot package

R:C3 plot Peter Lin 2018-06-02 library (ggplot2) x=c( "vs" , "cyl" , "carb" , "gear" ) for...

Donate-2

Donate-2