Updating/drawing all axes.

Greetings, MatPlotLibbers.

Since 1.1, pyplot.draw() in interactive mode only updates the current axis. If I want to update many axes, I need to use sca() and draw() for each one. Is there a way to update all axes?

Thanks.

-dw

.draw()

Greetings, MatPlotLibbers.

Since 1.1, pyplot.draw() in interactive mode only updates the current axis.
If I want to update many axes, I need to use sca() and draw() for each one.
Is there a way to update all axes?

I'm not seeing this, and I'm not sure *why* it would be occurring for
you. plt.draw triggers a call to fig.canvas.draw which calls draw on
all axes. Here is some example code in ipython, which has 'ion".

  In [2]: fig, axes = plt.subplots(2)

  In [3]: axes[0].plot([1,2,3])
  Out[3]: [<matplotlib.lines.Line2D at 0x4b90550>]

  In [4]: axes[1].plot([1,2,3])
  Out[4]: [<matplotlib.lines.Line2D at 0x4b90610>]

  In [5]: plt.draw()

The call to 'plt.draw' on line 5 triggers a draw to both axes. Can
you provide an example which exposes your problem? Please also
provide backend and OS information

  In [6]: !uname -a
  Linux pinchiepie 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25
UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

  In [7]: import matplotlib; print matplotlib.__version__
  1.2.x

  In [8]: matplotlib.rcParams['backend']
  Out[8]: 'WXAgg'

JDH

···

On Sun, Oct 30, 2011 at 10:51 AM, Daniel Welling <dantwelling@...287...> wrote:

Sorry for the very slow reponse time; it’s a busy time of the year. Anyway, I’ve narrowed the problem quite a bit.

Here is the kind of situation that causes the issue:

import matplotlib.pyplot as plt

plt.ion()

f1=plt.figure()

a1=f1.add_subplot(111)

f2=plt.figure()

a2=f2.add_subplot(111)

a1.plot([0,1])

a2.plot([0,1])

plt.draw()

Here, f2 is drawn but f1 only draws the axis object without the line; you must do something else to trigger f1 to draw (e.g. use one of the gui features or make it the current axis, then draw.) The key to recreating this issue is to make the plots in “parallel”, that is, make one fig, make another, make one ax, make the other, plot one line, plot the other, etc.

This will narrow it down further: I can only recreate this issue on my OS X system; my Ubuntu box does not have this issue. Here’s as much info as I can drum up now; let me know what else would be helpful.

OS X 10.6.8, Python 2.6.7 (r267:88850, Oct 17 2011, 15:53:34); IPython 0.10.1 (all installed through MacPorts.) MPL 1.1.0 obtained from the MPL website and installed manually (e.g. not through macports); TkAgg backend. Because it’s a macports install, it should be a mac Framework install of python.

Again, this problem did not manifest until MPL 1.1.0.

Thanks for your help.

-dw

···

On Sun, Oct 30, 2011 at 10:06 AM, John Hunter <jdh2358@…287…> wrote:

.draw()

On Sun, Oct 30, 2011 at 10:51 AM, Daniel Welling <dantwelling@…287…> wrote:

Greetings, MatPlotLibbers.

Since 1.1, pyplot.draw() in interactive mode only updates the current axis.

If I want to update many axes, I need to use sca() and draw() for each one.

Is there a way to update all axes?

I’m not seeing this, and I’m not sure why it would be occurring for

you. plt.draw triggers a call to fig.canvas.draw which calls draw on

all axes. Here is some example code in ipython, which has 'ion".

In [2]: fig, axes = plt.subplots(2)

In [3]: axes[0].plot([1,2,3])

Out[3]: [<matplotlib.lines.Line2D at 0x4b90550>]

In [4]: axes[1].plot([1,2,3])

Out[4]: [<matplotlib.lines.Line2D at 0x4b90610>]

In [5]: plt.draw()

The call to ‘plt.draw’ on line 5 triggers a draw to both axes. Can

you provide an example which exposes your problem? Please also

provide backend and OS information

In [6]: !uname -a

Linux pinchiepie 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:56:25

UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

In [7]: import matplotlib; print matplotlib.version

1.2.x

In [8]: matplotlib.rcParams[‘backend’]

Out[8]: ‘WXAgg’

JDH