show()

Jean-Michel> Perfect! This is exactly what I needed for one of my
    Jean-Michel> apps.

Glad that worked for you.

    >> But if you really want full control with no magic globals, I
    >> suggest using the matplotlib API rather than the matlab
    >> interface. Here is a minimal example with the SVG backend to
    >> create a figure w/o the matlab interface

    Jean-Michel> Well, what do you exactly mean by full control? The
    Jean-Michel> fact that the figure is no more controlled by
    Jean-Michel> matplotlib.matlab (as matlab does) but under my own
    Jean-Michel> control? So that the application is now fully
    Jean-Michel> responsible for displaying it?

    Jean-Michel> NB: currently I'm targeting TkAgg.

What I mean is that is that if you want to explicitly control when
your figure windows are shown, you need to use the matplotlib API, and
example of which for tkagg is at
http://matplotlib.sf.net/examples/embedding_in_tk.py. In this case,
you explicitly make the calls to show or hide your window when you
want. If you use the matlab interface, you are constrained either to
1) if interactive is False, show all of your figures at the end of the
script when you call show or 2) if interactive is True, show all your
windows at the time of their creation.

Actually, you may have a 3rd (untested, unsupported) option with the
matlab interface. Thanks to the changes Fernando and I introduced to
support ipython, I believe as of matplotlib 0.62 it is safe to call
show repeatedly without blocking script execution. You may want to
test this and report back.

    Jean-Michel> I'm afraid I don't understand why this should remove
    Jean-Michel> "magic" globals, I feel some globals are still
    Jean-Michel> required...

Some people do not like to use the matlab interface because it manages
the current figure and axes for them, behind the scenes. Eg when you
type plot(x,y), the plot command is sent to the current figure and
axes, as in matlab, which are stored as "global" (actually module
level) variables in matplotlib.matlab. In the matplotlib API, you
have to explicitly instantiate the figure and axes, and direct your
plotting, saving, etc commands to these instances, as in

    from matplotlib.numerix import arange, sin, pi
    from matplotlib.figure import Figure
    f = Figure(figsize=(5,4), dpi=100)
    a = f.add_subplot(111)
    t = arange(0.0,3.0,0.01)
    s = sin(2*pi*t)
    a.plot(t,s)

In a complex, nested application or script, it is sometimes nice to
have this extra degree of clarity.

Hope this helps,
JDH