Dear all, I have now implemented the draw_path_collection, draw_quad_mesh, and draw_markers methods in the Mac OS X native backend (see patch 2179017 at http://sourceforge.net/tracker/?func=detail&atid=560722&aid=2179017&group_id=80706). Some timings are below. In terms of raw drawing speed, the native backend can be either faster or slower than agg. On the other hand, the native backend can be considerably faster if the agg backend uses many calls to draw(); the native backend can avoid these superfluous because it has complete control over the event loop (see the third example below).
Best, --Michiel. # Scatter plot n = 1e6 import matplotlib.pyplot as plt f=plt.figure() import numpy as np x=np.arange(n) y=np.sin(x) ax=f.add_subplot(111) plt.scatter(x,y,c=x**2.0) # Time in seconds # n 100,000 1,000,000 2,000,000 3,000,000 # MacOSX 6 45 92 140 # WxAgg 7 56 112 172 # TkAgg 9 56 113 172 # GtkAgg 7 55 111 173 # Quad mesh import numpy as np from matplotlib.pyplot import figure, show, savefig from matplotlib import cm, colors from numpy import ma n = 1000 x = np.cos(np.linspace(-1.5,1.5,n)) y = np.linspace(-1.5,1.5,n*2) X,Y = np.meshgrid(x,y); Qx = np.sin(Y**2) - np.cos(X) Qz = np.sin(Y) + np.sin(X) Qx = (Qx + 1.1) Z = np.sqrt(X**2 + Y**3)/5; Z = (Z - Z.min()) / (Z.max() - Z.min()) # The color array can include masked values: Zm = ma.masked_where(np.fabs(Qz) < 0.5*np.amax(Qz), Z) fig = figure() ax = fig.add_subplot(111) ax.set_axis_bgcolor("#bdb76b") ax.pcolormesh(Qx,Qz,Z) show() # Timings in seconds # n Mac OS X TkAgg # 500 6 6 # 1000 23 7 # 2000 138 40 # Subplots from pylab import * figure() x=np.arange(20) y=1+x**2 n = 4 for i in range(n*n): subplot(n,n,i+1) bar(x,y,log=True) xlim(-5,25) ylim(1,1e4) # Timings in seconds # n Mac OS X TkAgg # 2 2 6 # 3 3 23 # 4 5 66 --- On Tue, 10/28/08, Michiel de Hoon <mjldeh...@yahoo.com> wrote: > --- On Tue, 10/28/08, John Hunter <jdh2...@gmail.com> > wrote: > > I haven't had a chance to look at the code yet, > > but I suspect he hasn't implemented the > > path collection draw method. If it's not > > implemented, we fall back on drawing each path > > separately, which is a lot slower. scatter ultimately > > triggers a call to Renderer.draw_path_collection > > which has a default implementation and a specialization > > in backend_agg. > > Good point. Indeed I was not aware of the > draw_path_collection method and I have not implemented it. I > will implement this method and report back with the timings > for Eric's example. ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel