Hi, I'm stacked again, sorry, but I couldn't find any pointers with my google.

In my filled contour animation I thought to use colorbar instead complicating 
with contour labeling, which just makes animation too full. So after reading 
the docs, I used something like this simplified code:

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


def init():
    return ax.cla(),

def animate(i):
    global t
    r = np.random.random(10)
    c = np.sin(2 * np.pi * r) * np.vstack(np.cos(2 * np.pi * r))
    ax.cla()
    cax = ax.contourf(c)
    cbar = fig.colorbar(cax, ticks=[0, .3, .6, 1])
    cbar.ax.set_yticklabels(['a', 'b', 'c', 'd'])
    return ax,


if __name__ == '__main__':
    fig = plt.figure()
    ax = fig.add_subplot(111)
    anim = animation.FuncAnimation(fig, animate, init_func=init,
                                   frames=100,
                                   interval=15,
                                   blit=True)
    anim.save('test.mp4', fps=15, extra_args=['-vcodec', 'libx264'])
==================================================

and noticed that colorbar object is not cleared from the scene, but it 
repeatedly fills the plot until there are only colorbars on it. Here is sample 
frame:

http://i.imgur.com/ydoUFrO.png

And I have no idea how to clean it. Can anyone tell me how to clean this 
colorbar while iterating animation?

Thanks


------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to