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.
clipping_benchmark.py (363 Bytes)
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA