[SciPy-user] gplt and xplt

John Hunter jdhunter at ace.bsd.uchicago.edu
Sun Aug 15 12:23:58 EDT 2004


>>>>> "David" == David Grant <david.grant at telus.net> writes:
    David> In the script above, how would you make the graphs show to
    David> the screen and not just save to a file?

Just to make sure we are clear - David Cook asked specifically about
using the pure OO API rather than the matlab interface.  If all you
want to do is show some graphs to the screen, the easiest way is to
use the matlab interface (I'll be happy to provide a sample) because
it manages all the complexities of creating the navigation toolbar,
creating and realizing the figure windows, etc...

But I'm assuming you indeed want to know how to use the OO API to show
figures to the screen.  There are a number of examples in the
matplotlib/examples directory of the src distribution (also at
http://matplotlib.sourceforge.net/examples).  How you do this depends
on the GUI package you are using (Tkinter, pygtk, wxpython...).  See
for example embedding_in_gtk2.py, mbedding_in_tk.py, and
embedding_in_wx2.py.

Basically, to create multiple figures using the API, you instantiate
multiple canvases for the backend of your choice, as in the example
above but importing a different canvas, eg FigureCanvasWXAgg.  Then
you embed these canvases in a GUI window (all the matplotlib GUI
FigureCanvases derive from a widget that can be directly embedded in a
GUI windowm

Let me know if you have any more questions or if these examples above
aren't clear.

JDH






More information about the SciPy-User mailing list