[SciPy-User] Some interactive Python tutorials on basic stats, possibly useful for teaching
Christopher Barker
Chris.Barker at noaa.gov
Thu Feb 17 16:12:34 EST 2011
On 2/17/11 12:29 PM, Raj wrote:
> I confess that I don't really understand the ion() command.
> The Matplotlib documentation says that this turns on interactive mode,
> but what exactly does that entail?
what it does is set MPL to re-draw the figure whenever a change is made.
Otherwise it only re-draws when specifically instructed to do so.
> I thought that interactive mode referred only to when
> you are running a Python session and typing in new commands,
> with each new plotting command adding to the plot straight away.
> But I guess it must also have some effect on GUI behavior
> during the running of a script, too.
It behaves the same way in either case, but is far more likely to be
desired when typing commands one by one in a shell.
> I would be very grateful to hear people's thoughts
> on whether they might be any potential downsides
> to inserting this ion() command.
I wouldn't generally do it in a script -- only if you want the user to
see the figure built up as changes are made.
> Apparently it can sometimes make graphics much more sluggish (?).
yup -- if you are making a lot of changes, you don't want MPL to re-draw
until they are all done.
> Matplotlib GUIs appear to run slightly differently on Linux
> depending upon which backend is being used,
> and I don't know enough to know whether this ion() command
> would help to make the scripts' behavior either
> more consistent or less consistent across various backends.
nope, that's a separate issue.
> Also, I don't know enough to know whether the ion() command
> ends up having the same effect as running the scripts
> from an "ipython -pylab" session.
nope -- ipython's "pylab" mode mostly has to do with how ipython
interacts with the mainloop of the GUI backend, though it also sets up
matplotlib for you, perhaps turning on interactive mode.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the SciPy-User
mailing list