is there any alternative to savefig?
Alf P. Steinbach
alfps at start.no
Thu Jan 28 16:47:33 CET 2010
> On Jan 28, 12:29 pm, kiwanuka <robert.kiwan... at gmail.com> wrote:
>> Hi all,
>> I wonder if anyone knows any alternative function in pylab (or
>> otherwise) that could be used to save an image. My problem is as
>> from pylab import *
>> fig1 = gca()
>> fig2 = gca()
>> fig3 = gca()
>> for i,data_file in enumerate(data_file_list):
>> time,x, y,x2, y2 = read_csv_file_4(open
>> fig1.set_title("y1 - x1")
>> fig2.set_title("y1 - time")
>> fig3.set_title("x1 - time")
>> In the above code, I read multiple data files and plot three separate
>> figures. Now I would like to save each of the figures to a file as the
>> commented savefig satements suggest. The trouble is that if I
>> uncomment all those savefig statements, I get three saved images all
>> containing the plot belonging to figure(3), which was the last figure
>> I understand this to be happening because savefig will save the
>> "current" figure, which in this case happens to be the last one
>> If I could do something like fig1.savefig("y1-x1.png") or savefig("y1-
>> x1.png").fig1, this would solve the problem but I'm not aware of any
>> such methods or modules to enable this. This is thus a flaw in the
>> general design/implementation of the savefig function, but is there an
>> alternative function to enable me achieve what I need? Is there
>> perhaps a possible tweak to savefig to make it do the same?
>> Thanks in advance,
> Problem solved.
That's nice, but would you mind telling the group the solution?
Assuming that you haven't (I don't see all messages posted to the e-mail list,
only what's propagated to Usenet or originating there).
More information about the Python-list