Benjamin Root on my suggestion that one can use del instead of
remove :
There are methods for ax that properly handle removal of
types of artists that have been attached to an axes. The above
approach assumes that no other collections have been plotted
that you wanted to keep. The approach I gave is a very surgical
method that makes sure that only what is supposed to be removed
gets removed. Both are valid, and their usefulness depends upon
which view of the data you need (remove types of artists versus
removing particular artists).
Yes, absolutely.
With just a little remark: remove is a Python function which
searches the list for a given value. del uses indices, so
del lst[10000]
will be most probably faster than lst.remove(value), if this value
happens to occur for the first time at index 10000. Unless
Matplotlib uses a specially tuned version of remove.
Under Windows XP, ion() is not too
compatible with show().
TKAgg (by default), WXAgg and GTKAgg bomb Bens program (and
without
draw() nothing is plotted).
That would be a bug and should be reported (assuming that it is
in the latest version). Make sure that you are using at least
v1.0.1 (preferably v1.1.0) to make sure that show() should do
what you want. Any version earlier than v1.0.1 is very
unpredictable with respect to multiple show() calls.
I use 1.1.0. (Python 2.7.2) I didn't report any bug because I didn't
know whether this was a bug…
But there are more...
The animation module uses various timers depending on the back-end.
This is – perhaps – the result of the fact that Python standard
Timer (a subclass of Thread) is, to say it mildly, rather weak. So,
under Tk the system uses after(), wx offers its timers, etc. Timed
animation works differently under various backends.
Here:
is a program which simulates/visualizes a simple-minded 2D Ising
model (vectorized Metropolis Monte-Carlo; not exactly physical,
but only mister Nobody is perfect…). It should update the picture
dynamically, and my students can see how the ferromagnetic domains
develop.
When run with Tk, OK. GTK and wx – no. The animation runs, but the
figure is frozen for many seconds, and it is updated when the Slider
is activated. The autonomous refreshing of the image is much much
slower than under TK. I don’ understand what is happening…
Tested on Windows XP, and under Linux (Fedora). I repeat, the
animation runs, this is a problem of refreshing the display.
Thank you, and all the best.
Jerzy Karczmarczuk
···
http://users.info.unicaen.fr/~karczma/TEACH/Test/isingVZ.py