|
From: John H. <jd...@gm...> - 2007-10-19 13:21:48
|
On 10/19/07, Darren Dale <dar...@co...> wrote:
> A while back I put in quite a bit of effort into enabling draw_markers in the
> postscript backend. This is an efficient RendererPS function both in terms of
> speed and file size, but it seems to not be used any more in favor of the
> less efficient draw_polygon. Does anyone know why?
Which artist is triggering this call? The RendererPS defines
draw_markers, and this is the test Line2D uses to determine which
function to call:
self._newstyle = hasattr(renderer, 'draw_markers')
thus newstyle will be True for PS. Then, in the Line2D marker drawing
function, eg
def _draw_square(...):
if self._newstyle:
path = agg.path_storage()
path.move_to(-offset, -offset)
path.line_to(-offset, offset)
path.line_to(offset, offset)
path.line_to(offset, -offset)
path.end_poly()
renderer.draw_markers(gc, path, rgbFace, xt, yt,
self.get_transform())
else:
so my guess is Line2D *is* using draw_markers for backend_ps.
Patches.Polygon and derived will still be using the old draw_polygon,
but there is no speed bottleneck here since one normally just adds a
few Polygon instances manually (else use a Collection). The case we
were trying to optimize with draw_markers was
ax.plot(x, y, 'o')
and related, where a 10,000 marker plot was triggering 10,000 calls to
draw_polygon, and now triggers one call to draw_markers for backends
that define it.
Note that in Michael's branch, this is mostly moot. He has completely
rewritten the transforms module in python and migrated to a path based
drawing model, overhauling Line2D, Patch and Collections in the
process. His branch is passing 75% or more of the examples and he
is hammering away at the rest -- so far he has been concentrating on
Agg but has recently begun the postscript work. It is will worth a
look, as this will be merged back into the trunk, probably after the
next major release.
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/transforms
mgd
JDH
|