[Crash with matplotlib and 14415 points help please :) ]

Hello to all,
I'm finishing to convert a module for linear regression that I used in Matlab. It takes an experimental matrix, and a response matrix perform a regression and a bit of plot and then give me 3 matrices that I need to plot response surface and leverage surface. For plotting leverage and response I need to create a kind of grid of point with another program. and at this point everything work fine (checked also in comparison with matlab). The problems come when I tri to plot it. For a step of 2 (not really a grid) it works with 30 steps everything crashes :frowning:
so nste=2 work nstep=30 not
I attach the file that give no problems it's a module with included the matrix to be plotted with nstep=2 and also the problematic one. a function with the same name of the plot and the matrices that give the problems.
Every help would be greatly appreciated because if I fix it I can get rid of the regression program in matlab that i generally use really a lot in my everyday job
Giorgio

test.tar.tar.bz2 (9.25 KB)

pyplotlev.py (768 Bytes)

pyplotlevm.py (6 KB)

I've retried reloading the matrices after restaring everything twice and it seems to plot. Probably the problem is that the memory is "occupied" from previous plots. I noticed also that the possibility to command come back to the console only after the last plot is close manually ..any hints
Is there a way to "clean" the memory for a new start.. the command close doesn't seem to work ?
Here's the module that make the only previous plot before trying to do the meshcountour

pyreg.py (9.1 KB)