memory error with matplot

Tommy Grav tgrav at mac.com
Tue Dec 5 08:24:14 EST 2006


It is hard to know what is wrong when we do not know how the
wrapper around the function works. The error could also be in
ConstructFigName or ConstructFigPath. Also please send the
specific error message when asking for help as that significantly
helps in tracking down the error.

Cheers
    Tommy

tgrav at mac.com
http://homepage.mac.com/tgrav/
------------------------------------------------------------------------ 
-----------------
"Any intelligent fool can make things bigger, more complex, and
more violent. It takes a touch of genius -- and a lot of courage --
to move in the opposite direction" -- Albert Einstein




On Dec 5, 2006, at 8:12 AM, lisa.engblom at gmail.com wrote:

> Hi,
>
> I am using matplotlib with python to generate a bunch of charts.  My
> code works fine for a single iteration, which creates and saves 4
> different charts.  The trouble is that when I try to run it for the
> entire set (about 200 items) it can run for 12 items at a time.  On  
> the
> 13th, I get an error from matplotlib that says it can't access data.
> However, if I start the program at the point it failed before it works
> fine and will create the charts for the next 12 before failing.  I
> assume that I am not closing the files properly somehow or otherwise
> misallocating memory.  I tried just reimporting pylab each iteration,
> but that didn't help.  This is the function that creates a chart:
>
> #create and save the figure
> def CreateFigure(state, facility, unit, SO2, increment, year, P99):
>     size = len(SO2)
>
>     #Create Plot
>     figure(1, figsize=(10,8))
>     bar(range(1, size+2), SO2, width=0.1, color='k')
>     grid(True)
>     xlim(0,size)
>     ylim(0, 1.1*SO2[-1])
>     ylabel('SO2 [lb/hr]')
>     heading = ConstructFigName(state, facility, unit, increment, year)
>     title(heading)
>
>     #set handles
>     xticklines = getp(gca(), 'xticklines')
>     xgridlines = getp(gca(), 'xgridlines')
>     xticklabels = getp(gca(), 'xticklabels')
>     yticklines = getp(gca(), 'yticklines')
>
>     #set properties
>     setp(xticklines, visible=False)
>     setp(xgridlines, visible=False)
>     setp(xticklabels, visible=False)
>     setp(yticklines, visible=False)
>
>     axhspan(P99, P99, lw=3, ec='r', fc='r')
>     ax = gca()
>     #P99 = str(P99)
>     P99 = '%0.1f' % P99
>     text(0.01, 0.95, '99th Percentile: '+P99+' lb/hr',
> transform=ax.transAxes)
>
>     figpath = ConstructFigPath(state, facility, unit, increment, year)
>     savefig(figpath)
>     close()
>
> Can you see the problem?
>
> thanks,
> -Lisa
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061205/3906d7cf/attachment.html>


More information about the Python-list mailing list