How to give a name to a figure?

Hi,

I'm a (still) beginner in scipy and I have a small problem with figures. Let me
explain.

I have to plot a lot of huge data so I have a lot of figures. I have set title and axes names. All the handles are in a list (the list can vary at run time according to the user input).

My goal is to save the figures (with savefig()). For this I want to write a loop which look like this:
for fig in fig_list
    figure(fig) # Select current figure
    savefig('%s.png' % fig.title, format='png') # Save it as 'title'.png

The problem is well explained in a previous message:
http://sourceforge.net/mailarchive/message.php?msg_id=a7f1ef730709101012o20abd37aj116e100d9b105d52%40mail.gmail.com
but nobody has answered to this post.

Any help would appreciated.
Regards,
Mathieu

To change the window title, you may use

fig.canvas.set_window_title("My Title")

But I couldn't find any public method to obtain the current window title.

If you just want to have a title associated with a figure, I guess you
can simply define your title attribute. For example,

fig.my_figure_title = "My Title"

Then when you want to save the figure later,

fig.savefig(fig.my_figure_title + ".png")

IHTH,

-JJ

···

On Mon, Sep 15, 2008 at 2:51 PM, Mathieu Dubois <mathieu.dubois@...2154...> wrote:

Hi,

I'm a (still) beginner in scipy and I have a small problem with figures.
Let me
explain.

I have to plot a lot of huge data so I have a lot of figures. I have set
title and axes names. All the handles are in a list (the list can vary
at run time according to the user input).

My goal is to save the figures (with savefig()). For this I want to
write a loop which look like this:
for fig in fig_list
   figure(fig) # Select current figure
   savefig('%s.png' % fig.title, format='png') # Save it as 'title'.png

The problem is well explained in a previous message:
http://sourceforge.net/mailarchive/message.php?msg_id=a7f1ef730709101012o20abd37aj116e100d9b105d52%40mail.gmail.com
but nobody has answered to this post.

Any help would appreciated.
Regards,
Mathieu

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Kind of awkward, but

fig.canvas.manager.window.wm_title()

returns the current title...

Michael.

···

On Sep 15, 2008, at 4:53 PM, Jae-Joon Lee wrote:

To change the window title, you may use

fig.canvas.set_window_title("My Title")

But I couldn't find any public method to obtain the current window title.

Kind of awkward, but

fig.canvas.manager.window.wm_title()

I guess this is backend dependent. In my Gtk backend, I don't have
such a method. But I found fig.canvas.manager.window.get_title().
Thanks!

-JJ

Hi everyone,

Sorry for the delayed response.

Thank you very much everyone for the help.

Maybe it would be a good idea to add a 'window_title' keyword to figure() (� la matlab ;).

kind regards,
Mathieu
Jae-Joon Lee wrote:

···

Kind of awkward, but

fig.canvas.manager.window.wm_title()

I guess this is backend dependent. In my Gtk backend, I don't have
such a method. But I found fig.canvas.manager.window.get_title().
Thanks!

-JJ

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

The matplotlib figure is contained in a FigureCanvas which is
contained in a FigureManager, and the manager has a method to set the
window title:

  fig.canvas.manager.set_window_title('some title')

unfortunately, there is no method provided to *get* the window title
for reuse later by savefig (we need to add it). You can, however, use
the figure label (all matplotlib artists from lines, to text, to the
axes to the figure have a label property. So something like this
should work

    import matplotlib.pyplot as plt
    fig = plt.figure()
    title = 'some title'
    fig.set_label(title)
    fig.canvas.manager.set_window_title(title)

and later:

    fig.savefig(fig.get_label())

Hope this helps,
JDH

···

On Mon, Sep 15, 2008 at 1:51 PM, Mathieu Dubois <mathieu.dubois@...2154...> wrote:

Hi,

I'm a (still) beginner in scipy and I have a small problem with figures.
Let me
explain.

I have to plot a lot of huge data so I have a lot of figures. I have set
title and axes names. All the handles are in a list (the list can vary
at run time according to the user input).

My goal is to save the figures (with savefig()). For this I want to
write a loop which look like this:
for fig in fig_list
   figure(fig) # Select current figure
   savefig('%s.png' % fig.title, format='png') # Save it as 'title'.png

The problem is well explained in a previous message:
http://sourceforge.net/mailarchive/message.php?msg_id=a7f1ef730709101012o20abd37aj116e100d9b105d52%40mail.gmail.com
but nobody has answered to this post.