如何制作电影(相对于Matlab)?

如何制作电影(相对于Matlab)?

问题描述:

我在matlab中有此代码(在一个函数中):

I have this code in matlab (in one function):

...
m = size(myList, 3);
for k = 1:m
    g = myList(:, :, k);
    image(g + 1)
    axis off
    axis square
    M(k) = getframe;
end;

和另一个文件(另一个功能):

and in another file (another function):

...
M = showGraphs(grids)
movie(M, 1)

我想在matplotlib中制作电影.到目前为止,我还是(对于第一段代码):

I want to do the movie in matplotlib. Until now, I did (for the first piece of code):

m=sc.shape(myList,3)
for k in range(m):
    g=myList[:,:,k]
    plt.axis("False")
    plt.imshow(g+1) -->> i don't know if it's right

我不知道该如何处理M(k)=getframe,然后再处理movie(M,1).

I don't know what to do with M(k)=getframe and then with movie(M,1).

我该如何进行?因为我对matplotlib中的方法感到困惑.

How can I proceed? because I'm confused about the way in matplotlib.

---- UPDATED ------------------------------

----UPDATED------------------------------

我做到了:

 n=sc.shape(data)[2]
    ims=[]
    for i in range(n):
        mydata=data[:,:,i]
        im=plt.imshow(mydata,cmap=plt.get_cmap('jet'))
        ims.append([im])
    return ims

然后:

fig=plt.gcf()
ani=ArtistAnimation(fig,result,interval=10,repeat=False)

有很多不同的方法,请参见以下动画示例:

There's a bunch of different ways, see the animation examples, here: http://matplotlib.sourceforge.net/examples/animation/index.html