[Matplotlib-devel] Fwd: Creating an interactive figure from the OO interface

Thomas Caswell tcaswell at gmail.com
Fri Sep 18 00:15:49 CEST 2015

---------- Forwarded message ---------
From: Thomas Caswell <tcaswell at gmail.com>
Date: Thu, Sep 17, 2015, 15:15
Subject: Re: [Matplotlib-devel] Creating an interactive figure from the OO
To: Nathan Goldbaum <nathan12343 at gmail.com>

It is backend dependent and when ever i try to explain it mdehoon tells me
i am wrong (and i believe him about that).

To address your original question, i will be more clear in the finial
release notes. The new feature is that using the OO interface on artists in
figures created by pyplot causes automatic redrawing.


On Thu, Sep 17, 2015, 14:52 Nathan Goldbaum <nathan12343 at gmail.com> wrote:

On Thu, Sep 17, 2015 at 4:50 PM, Thomas Caswell <tcaswell at gmail.com> wrote:

If you are not going through pyplot you may have to manage
starting/integrating with the gui main-loop your self.

Is there an example of how to integrate with a GUI event loop somewhere?

There is an on-going project (and one failed project) to pull apart
`new_figure_manager` and `pyplot`.

Cool! For now I'm tempted to restrict this functionality to nbagg, which
does seem to work properly.


On Thu, Sep 17, 2015 at 4:53 PM Nathan Goldbaum <nathan12343 at gmail.com>

Just to follow up with a concrete example, the following code does seem to
*draw* a plot on the matplotlib 1.5rc, but the gui loop seems to hang after
calling show(), forcing me to kill the python process.


import matplotlib.backends.backend_macosx as backend

from matplotlib.figure import Figure

manager = backend.new_figure_manager(0)

fig = manager.canvas.figure

ax = fig.add_subplot(1,1,1)




If I do something similar via pyplot, everything works as expected:


import matplotlib.pyplot as plt

fig = plt.figure()

ax = fig.add_subplot(1,1,1)




On Thu, Sep 17, 2015 at 3:44 PM, Nathan Goldbaum <nathan12343 at gmail.com>

Hi all,

(resending this since I originally sent it to the old sourceforge list,
sorry if this double-posts)

I see in the matplotlib 1.5 release notes that figures created via the OO
interface can now be interactively updated.

Does this mean it's now possible to manually create a figure manager using
an interactive backend, create a plot using the figure manager and then
call the show() method on the figure manager to display the plot in an
interactive window, all without (possibly indirectly) importing pyplot? If
not, should I just give up and do this via pyplot? I'd like to avoid
importing pyplot if possible to avoid crashes on headless sessions.

Thanks for your help or advice,


Matplotlib-devel mailing list
Matplotlib-devel at python.org
https <https://mail.python.org/mailman/listinfo/matplotlib-devel>://
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20150917/ed1e4655/attachment-0001.html>

More information about the Matplotlib-devel mailing list