Firstly I would like to apologize in case this should belong in the
matplotlib-users, I'm not sure if this is dev or users related.


Let us say we want to animate a 2D contour plot, then passing the blit =
True argument to FuncAnimation fails since the QuadContourSet has no axes
attribute.

Is it for some specific it is implemented like this? And maybe there a hack
to get this to work?

A working code example with the actually wanted one commented out.

import numpy as np
import matplotlib.animation as animation
from matplotlib import pyplot as plt

fig, ax = plt.subplots()

x = np.linspace( -np.pi, np.pi, 50 )
y = np.linspace( -np.pi, np.pi, 50 )
X, Y = np.meshgrid( x, y )
Z = np.zeros( X.shape )

def init():
    cont = ax.contourf( X, Y, Z )
    cbar = plt.colorbar( cont )
    return cont,

def animate( t ):
    k = np.array( [1,1] )
    omega = 0.5

    x = np.linspace( -np.pi, np.pi, 50 )
    y = np.linspace( -np.pi, np.pi, 50 )
    X, Y = np.meshgrid( x, y )
    Z = np.exp( 1j * (omega* t - X*k[0] ) ) * np.exp( - 1j * k[1]*Y )
    cont = ax.contourf( X, Y, Z )
    return cont,

#ani = animation.FuncAnimation( fig, animate, frames = 100, interval = 1,
repeat = False, blit = True, init_func = init,)
ani = animation.FuncAnimation( fig, animate, frames = 100, interval = 1,
repeat = False,  init_func = init,)
plt.show()
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to