On Fri, Nov 12, 2010 at 4:20 AM, Olivier Verdier <zelb...@gmail.com> wrote:
> Hi,
>
> I would like to use matplotlib in a programmatic way.
>
> I thought about creating a Figure object (with no canvas), and plot in
> that Figure.
>
> Depending on what the user wants, I could then either plot on screen
> or save on file.
>
> The problem is that I don't know how to connect a Figure object to the
> FigureCanvas that the user chose in its preference file. In other
> words, I would like to do what the function figure() does, but for an
> existing Figure object.
>
> How could I do that?

If you are using a GUI backend (eg GTKAgg, WXAgg, TkAgg, QtAgg) for
your user interface and call fig.savefig with a hardcopy extension
like PDF, PNG, SVG, EPS or PS, it will do the backend switching for
you.  If you'd like to see an example of how to do that for your own
code if you need to, search for switch_backends in FigureCanvasBase:

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backend_bases.py?revision=8791&view=markup

JDH

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to