I was trying to use matplotlib to plot a series of 2D images, but
python was using up a large amount of RAM very quickly. I don't know
matplotlib that well, so the chance are I am missing something, would
appreciate it if anyone can point me to the right direction.
I am using:
Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Example code to run in interpreter mode:
···
########################################
from numpy import zeros
x = 1651
y = 452
page = zeros((x, y)).astype('float')
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
for i in range(1000):
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(page, cmap=plt.cm.spectral_r, extent=(-44, 176, -30,
30), interpolation = 'bicubic', vmin = -0.003, vmax = 0.003)
title = "Time = %(i)0.3es)" % {'i':i}
ax.set_title(title,fontsize=14)
fig.colorbar(cax, ticks=[-2e-3, -1e-3, 0, 1e-3, 2e-3],
orientation='horizontal')
fig.savefig('_tmp.' + str(i) + ".png", dpi=300)
############### EOF ################
I tired to delete everything in the namespace, but the only way I can
release the ram is by killing the python session.
Thanks for all the helps in advance.
iCy