Figure and Canvas

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?

Thanks!

== Olivier

Hi Oliver,

Have you looked at any examples on the matplotlib site? For instance, there are several examples about how to use wxPython (wx) with matplotlib. Also, there is a save feature currently available in current gui when you run figure() (it is a floppy disk in navigation panel below the figure).

Aman

···

On Fri, Nov 12, 2010 at 5:20 AM, Olivier Verdier <zelbier@…287…> 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?

Thanks!

== Olivier


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

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

···

On Fri, Nov 12, 2010 at 4:20 AM, Olivier Verdier <zelbier@...287...> 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?