Hello

I have a performance issue when using a Rectangle patch with linestyle 
'dotted'. Here is some code showing it:


from matplotlib import gridspec

gs = gridspec.GridSpec(1, 2)
ax1 = plt.subplot(gs[0, 0])
ax2 = plt.subplot(gs[0, 1])

data = [0, 1]

r1 = Rectangle([10, 0.25], 100000, 0.5, facecolor='None', 
edgecolor='red')
r2 = Rectangle([10, 0.25], 100000, 0.5, facecolor='None', 
edgecolor='red', linestyle='dotted')

ax1.add_patch(r1)
ax2.add_patch(r2)

ax1.plot(data)
ax2.plot(data)


The steps to reproduce:
- %paste the code in pylab
- select the zoom tool
- zoom on the left plot to the left of the figure until you see the data 
within the [0, 1] range, and zoom some more (no performance issue)
- zoom on the right plot to the left of the figure until you see the 
data within the [0, 1] range, the more you try zooming, the longer it 
takes to render
- try zooming on the left plot again, performance is now poor

So I understand I have three performance issues:
- behaviour is different depending on linestyle
- performance issue on second plot impacts first plot
- data outside of the view limits are taken into account for the 
rendering (performance hit even if Rectangle starts from x=10 but xlim 
was reduced by zooming to eg [0, 1])

I initially observed the problem in a wx application using WxAgg, I can 
reproduce it in pylab with TkAgg, on two separate computers.

I've tracked this down to an increasingly slow call in backend_agg.py 
(l.145, "self._renderer.draw_path(gc, path, transform, rgbFace)" in 
matplotlib 1.3.0). It then goes to native code, I stopped there.

Python 2.7.5, matplotlib 1.3.0 (also observed on 1.2.1).

(I have another issue if commenting out the two last lines and 
%paste-ing it to pylab, I then get an OverflowError, I don't know if 
this is related)

Thanks for your help
-- 
Sylvain

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to