[SciPy-user] How to give a name to a figure?

Mathieu Dubois mathieu.dubois@limsi...
Mon Sep 15 13:38:22 CDT 2008


Hi,

Thanks for your help but my problem is not to give a name to the file 
but to give a name to the figure itself.

The reason why I want this is that I have all my figure handles in a 
list and I want to do a loop like:
for fig in fig_list
    savefig(fig, fig.title, format='png')

The question was asked to the matplotlib users list some months ago:
http://sourceforge.net/mailarchive/message.php?msg_id=a7f1ef730709101012o20abd37aj116e100d9b105d52%40mail.gmail.com

As Robert Kern pointed out this question is matplotlib related and I 
don't want to pollute scipy list so I will continue discussion on 
Matplotlib-users list.

Thanks again for your help,
Mathieu

Nuttall, Brandon C wrote:
> Mathieu,
>
> Its pretty easy. The statements below do what you I want:
>
> (of course, you have to import pylab)
>
>   
>>>> path = 'c:\\documents and settings\\bnuttall\\desktop\\adair\\'
>>>> picfile = '%sR%s.png' % (path,str(wellid).rjust(7,'0'))
>>>>         
>
> ...snip... (a bunch of statements constructing the figure)
>
>   
>>>> pylab.savefig(picfile)
>>>>         
>
> In my case, the wellid is a serial integer that uniquely identifies the data set. I have coded similar statements to alter the path name systematically so that related output gets grouped in folders.
>
> Brandon Nuttall
>
> -----Original Message-----
> From: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] On Behalf Of Mathieu Dubois
> Sent: Monday, September 15, 2008 12:14 PM
> To: scipy-user@scipy.org
> Subject: [SciPy-user] How to give a name to a figure?
>
> Hi,
>
> I'm a beginner in scipy and I have a small problem with figures. Let me
> explain.
>
> I have to plot complicated data so I have a lot of figures. I have set
> title and axes names.
>
> My problem is that the windows are titled with things like 'Figure 1',
> 'Figure 2' etc. Is it possible to set this name to something more
> understable? Apparently title() changes the name of the plots inside the
> figure.
>
> My goal is to save (with savefig()) them with a nice name say
> 'title.png' (where title would be replaced by the title of my figure).
>
> Any help would be appreciated.
>
> Thanks in advance,
> Mathieu
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   



More information about the SciPy-user mailing list