[Numpy-discussion] numarray speed - PySequence_GetItem

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Jun 25 14:37:11 CDT 2004

>>>>> "Sebastian" == Sebastian Haase <haase at msg.ucsf.edu> writes:

    Sebastian> Hi, The long story is that I'm looking for a good/fast
    Sebastian> graph plotting programs; so I found WxPyPlot
    Sebastian> (http://www.cyberus.ca/~g_will/wxPython/wxpyplot.html)
    Sebastian> It uses wxPython and plots 25000 data points (with
    Sebastian> lines + square markers) in under one second - using
    Sebastian> Numeric that is.

Not an answer to your question ....

matplotlib has full numarray support (no need to rely on sequence
API).  You need to set NUMERIX='numarray' in setup.py before building
it *and* set numerix : numarray in the matplotlib rc file.  If you
don't do both of these things, your numarray performance will suffer,
sometimes dramatically.

With this test script

    from matplotlib.matlab import *
    N = 25000
    x = rand(N)
    y = rand(N)
    scatter(x,y, marker='s')

You can do a scatter plot of squares, on my machine in under a second
using numarray (wxagg or agg backend).  Some fairly recent changes to
matplotlib have moved this drawing into extension code, with an approx
10x performance boost from older versions.  The latest version on the
sf site (0.54.2) however, does have these changes.

To plot markers with lines, you would need

  plot(x,y, marker='-s')

instead of scatter.  This is considerably slower (approx 3s on my
system), mainly because I haven't ported the new fast drawing of
marker code to the line class.  This is an easy fix, however, and will
be added in short order.


More information about the Numpy-discussion mailing list