On Mon, Jul 5, 2010 at 3:17 AM, Ian Thomas <ianthoma...@googlemail.com> wrote:

> Yes, it does indeed take a long time for large grids. The bottleneck is line
> 51 in lib/matplotlib/tri/triplot - I use the plot command which creates a
> separate Line2D object for each edge in the triangulation, and there can be
> a lot of edges.  There is an obvious improvement of replacing this with a
> single LineCollection object, but it would require some manipulation of the
> line styles, colours, etc that the plot command does and I don't yet
> understand it sufficiently.

This could be made much faster using a compound Path for the edges and
a single call to "plot" for the markers on the flattened array of
vertices.  You would retain the generality of all the mpl markers in
this case, since you would be using "plot" for the verticies, but
might lose some of the generality of the line styles since we don't
have a class "LinePath" like we do in matplotlib.patches.PathPatch (eg
see http://matplotlib.sourceforge.net/examples/api/compound_path.html).
 It would be nice to see an analogue or PathPatch
matplotlib.lines.LinePath that exposes the relevant bits of the Line2D
interface (set_linestyle) etc, but you can get most of this by setting
facecolor='None' in the PathPatch.  In practice, you almost always
want a solid line for the edges I suspect.

In a nutshell, you could still support the plot format string but
manually pass it to Axes._process_plot_format.  Use the returned
results to set the properties on a single call to plot for the
flattened array of vertex markers, and a single compound PathPatch
with no facecolor for the edges (or you could support the facecolor if
you want).  Since PathPatch already supports linestyle, edgecolor and
linewidth, it should work.  And Paths support masks, so you should be
able to integrate the masking but I am not sure about this part since
I haven't delved deeply enough into the tri code to see how masking is
applied.

JDH

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to