We recently saw some breakage with our PyRAF plotting tool (which uses matplotlib as a "dumb" rendering backend) and matplotlib 0.99. It stops inside the subslice support that was added to Line2D, since subslicing requires that the Line2D object have an "axes" assigned to it. Since PyRAF doesn't use matplotlib's Axes objects, its lines don't have them.

It's a simple fix to check for the existence of an axes member and skip the subslice support if it doesn't have one. However, I wonder if it couldn't just be removed, especially since it is the only dependency on an Axes from Line2D objects. I think it may have become redundant wrt the path simplification code which now handles clipping (at the figure boundary, not the axis boundary mind you) rather reliably. The simplification code now also works in all backends, which is fairly new.

I did a little benchmarking with the attached script. It generates a 10,000 point random array and then plots a 500 point subset in the middle.

baseline:  3.94 fps (no clipping or subslicing)
subslice:  28.14 fps
clipping:  28.09 fps
clipping+subslice:  28.35 fps (i.e. current code)

The last three are close enough to be considered equal.

Of course, another benchmark may produce very different results, so I'm reluctant to just yank it. But it would be nice to remove nearly-identical optimizations.

Cheers,
Mike

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

import matplotlib
matplotlib.use("Agg")

from pylab import *

t = rand((10000))
plot(t, '-', lw=4)
xlim((5000, 5500))
show()

import time
frames = 1000
t = time.time()
c = time.clock()
for i in xrange(frames):
    draw()
wallclock = time.time() - t
user = time.clock() - c
print "wallclock:", wallclock
print "user:", user
print "fps:", float(frames) / wallclock
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to