Thanks for your reply.
In the gtk backend, draw_idle calls gobject.idle_add
Thus, "idle" means the gui event loop has no higher
priority events. Is
this condition reached only at the end of the script?
With Python, there is only one thread (running both Python and the GUI). So the GUI event loop won't start until the end of the script, so there is no inadvertent redrawing regardless of interactive being True or False.
With ipython, I am not sure if they are using one thread, or one thread for Python and one thread for the GUI. But in practice, in ipython I also don't find any evidence of inadvertent redrawing. For example, this script:
import matplotlib.pyplot as plt
x = numpy.random.random(400000)
y = x + numpy.random.random(400000)
plt.hexbin(x, y, gridsize=300)
for i in range(1000):
both with python and ipython take an equal amount of time regardless of interactive being True or False. If there were any redrawing after each call to plt.xlabel, this script would take forever.
Reminder: the interactive setting controls
draw_if_interactive, which is
what we are talking about here, but also whether or not
So we may not need draw_if_interactive, but unless we can
show entirely, we will still need an interactive setting.
If matplotlib were always interactive, then I don't see a good reason for non-blocking show().
Returning to the issue raised by the OP, however, the
whether the present MacOSX behavior (windows pop up) or the
behavior (they don't in non-interactive mode until/unless
called) is what we really want. It seems to me that
we should preserve
some way of getting this second behavior.
I agree. For example, if a user wants to make a figure for the sole purpose of creating a PNG file, there should be a way to do this without the figure popping up as a window.
--- On Sat, 11/13/10, Eric Firing <efiring@...202...> wrote: