I agree with Jae-Joon here -- try to reduce the number of points before passing it to matplotlib.

However, I'm a little concerned about the segfault -- I'd rather matplotlib give a MemoryError exception if that's in fact what is happening.  Jae-Joon -- can you share your test that causes the segfault?

The snippet below completely hogs my machine for a few minutes, but then, correctly, aborts with a MemoryError.

This is on FC11 i586, Python 2.6, Numpy 1.3.


from matplotlib.pyplot import *
import numpy as np

points = np.random.random((50000000, 2))



On 07/01/2009 01:34 PM, Jae-Joon Lee wrote:
A snippet  of code does not help much.
Please try to post a small concise standalone example that we can run and test.

A general advise is to try to reduce the number of plot call, i.e.,
plot as may points as possible with a single plot call.

However, 50million points seems to be awful a lot.
6 inch x 6 inch figure with dpi=100 has 0.36 million number of pixels.
My guess is that it makes little sense to plot 50 million points here.

Anyhow, plotting 50million points with a single plot call dies with
some segfault error in my machine. So, I feel that  matplotlib may not
be suitable for your task. But, John or others may have some insight
how to deal with.



On Tue, Jun 30, 2009 at 1:22 PM, Markus Feldmann<feldmann_markus@gmx.de> wrote:
Hi All,

my program lets slow down my cpu. This only appears if i plot to much
points. I am not sure how many point i need to get this, normally i plot
3*14e6 + 8e3, that is round about 50million points. My system is a
dual core 2GHz cpu with 2Gbyte Ram.

Here is my method to plot,
    def drawtransientall(self,min):
        self.subplot = self.figure.add_subplot(111)
        list_t1,list_peaks,t2,list_samples =
        offset = 0
        color = ['green','red','blue','magenta','cyan']
        markerPeaks = ['v','<','1','3','s']
        markerSamples = ['^','>','2','4','p']
        for i in range(len(self.showBands)):
            self.plots[0] +=
            self.plots[1] +=

            offset +=1

        ymax = np.amax(list_samples)
        ymin = np.amin(list_samples)
        self.subplot.set_ylim([ymin-np.abs(ymin)*0.1, ymax*1.2 + 2])
        self.subplot.set_ylabel("abs(Sample(t)) und
abs(Peak(t)+Offset)-->",fontsize = 12)
        self.subplot.set_xlabel("Zeit in Sek. -->",fontsize = 12)

Any ideas how to avoid the slow down of my cpu ?

regards Markus

Matplotlib-users mailing list


Matplotlib-users mailing list