I believe I have found a simple change that improves the rendering speed
of quiver plots, which can be quite slow for large vector fields. Based
on some profiling, the problem appears to stem from the use of numpy's
MaskedArrays in PolyCollection.set_verts. If I add the following line to
the top of the PolyCollection.set_verts function in collections.py:
verts = np.asarray(verts)
I find that quiver plots are drawn about 3 times as quickly, going from
2.6 seconds for a 125x125 field to 0.65 seconds. This does not seem to
break the use of MaskedArrays as inputs, and masked regions are still
hidden in the final plot. I do not know if this has any adverse effects
in other classes that inherit from PolyCollection.
Using:
python 2.6.2 on Windows XP
numpy 1.3.0
matplotlib 0.98.5.3, Qt4Agg backend
I do not know why iterating over MaskedArrays is so slow, but perhaps
this information can be used to speed up some other functions as well.
Ray Speth
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel