On Mon, Sep 15, 2008 at 1:51 PM, Mathieu Dubois <[EMAIL PROTECTED]> 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.
>

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

-------------------------------------------------------------------------
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
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to