[Numpy-discussion] matplotlib and numpy cause MemoryError

Robert Kern robert.kern at gmail.com
Wed Nov 18 16:51:32 EST 2009


On Wed, Nov 18, 2009 at 15:48, Mathew Yeates <mat.yeates at gmail.com> wrote:
> Hi
>
> I have a line of matplotlib code
>
> -self.ax.plot(plot_data,mif)
>
>
>
> that causes the line
>
> -self.data=numpy.zeros(shape=dims)
>
>
>
> to throw a MemoryError exception.
>
> (if I comment out the first line I get no error.)
>
> This is on a windows xp machine with latest numpy and the latest matplotlib.
>
>
>
> I have a feeling this may be a nightmare to figure out what matplotlib
> and/or numpy are doing wrong. Any ideas where I can start?

Print out dims just before the second line to make sure that it is
reasonable. A MemoryError is raised when numpy cannot allocate enough
memory on your system. If dims is too large for some reason, you could
run into that limit. It might be because what you are trying to plot
is simply too large or there might possibly (but unlikely) be a bug
that is miscalculating dims.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list