Scatter plots and GTK backend

Hello, I am having trouble viewing scatter plots of

    > large data sets with the GTK backend. The plots are
    > sparsity patterns of sparse matrices, much in the way
    > of Matlab's spy function. First of all, there may be a
    > conflict somewhere with my version of GTK/PyGTK;
    > issuing a plot() or scatter() command often results in
    > the message 'None Active' being displayed. After a
    > couple of seconds, the python prompt comes back, and
    > the 'scatter' command results in a huge number of
    > messages of the form

    > <matplotlib.patches.Circle instance at 0x4531730c>

Hi Dominique,

It looks like there is a "print" statement somewhere in your code.
It's possible that this was from a vestigial debug command I left in.
I don't get get it on my system. Are you using matplotlib-0.50? I
also don't get the "None Active" line.

I'm using this as a test script

    from matplotlib.matlab import *

    x = 100*rand(100000)
    y = 100*rand(100000)
    s = rand(100000)

    scatter(x,y,s)
    #plot(x,y,'o')
    show()

Takes about 30s on my system. Note that plot with circles can be must
faster that scatter if you don't need to vary the size or color of the
symbols.

    > begin displayed; litterally hundreds of them---it takes
    > some 10 seconds. Finally, a show() opens up a Figure
    > window, but no plot. The matrix has 80519 nonzero
    > elements and is symmetric, so the scatter plot contains
    > roughly twice as many points. I have a Gnuplot
    > interface and a spy-like function which works just fine
    > and displays the pattern in a matter of a fraction of a
    > second.

There are several areas where matplotlib performance is subpar -
mostly for large numbers of patches (circles for scatter, rectangles
for pcolor). Fixing this is a fairly high priority and I have a good
idea how to go about it - see
http://sourceforge.net/mailarchive/message.php?msg_id=7142332 for a
recent discussion. I think in the next 3-4 weeks I can get this
fixed. Basically, the plan is to set up an additional backend method
or two that the various backends may optionally implement in extension
code for performance.

    > Sometimes, a plot using the GTK backend gets stuck in
    > gtk.mainloop(), and i have to interrupt it with
    > Ctrl-C. I am using SuSE Linux 8.0. I have installed the
    > most recent versions of GTK and PyGTK.

Are you using the default GTK that comes with SuSE or did you upgrade?
I have gotten myself into a world of pain before trying to upgraded
GTK libs on a linux box. It does look like you are getting some
unusual behavior. Make sure you are using the latest matplotlib and
try running the test script I posted above. If you still get the same
errors, something is whacked with your install or paths. Otherwise,
stay tuned for performance enhancements coming soon to theaters
everywhere.

JDH

* On Mon, 01 Mar 2004, John Hunter wrote:

It looks like there is a "print" statement somewhere in your code.
It's possible that this was from a vestigial debug command I left in.
I don't get get it on my system. Are you using matplotlib-0.50? I
also don't get the "None Active" line.

I am in Windows 2000 and XP. I am using 0.50e in Linux, because i am
upgrading my gcc. The newer 0.50 won't compile with the gcc i have now.
I only get the 'None Active' in Linux though. I suspect it comes from
my GTK. I am using KDE and installing Gnome libraries when i need them.
There might be a glitch somewhere.

I'm using this as a test script

    from matplotlib.matlab import *

    x = 100*rand(100000)
    y = 100*rand(100000)
    s = rand(100000)

    scatter(x,y,s)
    #plot(x,y,'o')
    show()

Takes about 30s on my system. Note that plot with circles can be must
faster that scatter if you don't need to vary the size or color of the
symbols.

I see that plot is usually faster than scatter. The script works fine
with smaller data sets, and takes a pretty long time with larger sets.

There are several areas where matplotlib performance is subpar -
mostly for large numbers of patches (circles for scatter, rectangles
for pcolor). Fixing this is a fairly high priority and I have a good
idea how to go about it - see
http://sourceforge.net/mailarchive/message.php?msg_id=7142332 for a
recent discussion. I think in the next 3-4 weeks I can get this
fixed. Basically, the plan is to set up an additional backend method
or two that the various backends may optionally implement in extension
code for performance.

That would be wonderful. I have never looked into the Gnuplot code but
they have a fairly efficient algorithm. Plotting data sets like that i
described takes less than a second on my laptop (from the Python
interface). It would be great if matplotlib could do it too.

Are you using the default GTK that comes with SuSE or did you upgrade?
I have gotten myself into a world of pain before trying to upgraded
GTK libs on a linux box. It does look like you are getting some
unusual behavior. Make sure you are using the latest matplotlib and
try running the test script I posted above. If you still get the same
errors, something is whacked with your install or paths. Otherwise,
stay tuned for performance enhancements coming soon to theaters
everywhere.

You can be sure i'm staying tuned.

Dominique