>>>>> "Pellegrini" == Pellegrini Eric <[EMAIL PROTECTED]> writes:
Pellegrini> Hi everybody, I would like to build an application Pellegrini> where many filled polygons will have to be displayed Pellegrini> on the screen. To do so, I would like to use Pellegrini> matplotlib but, up to now, my application is not fast Pellegrini> enough. Hmm, I'm not seeing the performance problem on my system -- I can create and save the figure in a fraction of a second. Is your numerix setting set to numpy? Run the script with --verbose-helpful and send us the output. A few things to note: if you really want regular polygons, eg the squared in your example, do any of the plot markers work for you. plot(x, marker='s') will be about as fast as mpl gets. You can set the marker size with the markersize property. Second, if you need arbitrary polygons, and need a lot of them, a polygon collection will be faster. I had to bump the number of polys up to about 8000 to show a dramatic performance difference. Here are two scripts and performance numbers -- one using fill and one using a polygon collection > time python test.py -dAgg 6.595u 0.089s 0:06.68 99.8% 0+0k 0+0io 0pf+0w > time python test2.py -dAgg 0.565u 0.033s 0:00.59 100.0% 0+0k 0+0io 0pf+0w > cat test.py import pylab x = range(0,81000,10) pylab.axis('off') for i in range(0,len(x)-1): pylab.fill([x[i],x[i+1],x[i+1],x[i]],[10,10,20,20]) pylab.axis((0,max(x),0,610)) pylab.savefig('test') pylab.show() > cat test2.py import pylab from matplotlib.collections import PolyCollection fig = pylab.figure() ax = fig.add_subplot(111) x = range(0,81000,10) pylab.axis('off') verts = [((x[i], 10), (x[i+1], 10), (x[i+1], 20), (x[i], 20)) for i in range(len(x)-1)] col = PolyCollection(verts) ax.add_collection(col) pylab.axis((0,max(x),0,610)) pylab.savefig('test') pylab.show() ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users