From: Perry G. <pe...@st...> - 2004-12-11 17:07:28
|
John Hunter Wrote:> > Aside from the aforementioned "run" mode of ipython, which does just > this, the basic incantation is > > >>> from matplotlib import interactive, is_interactive > >>> b = is_interactive() # store the current interactive state > >>> plot(blah, blah) # make some plots > >>> interactive(False) # turn interactive off > >>> for i in arange(1e4096): plot(arange(i), arange(i)**2) # > don't try this at home > >>> interactive(b) # restore previous interactive state > > Basically, this is what ipython does. This is wrapped into a single > function "run", called like > > >>> x = 1 # some fluff > >>> run ~/myexamples/simple_demo.py # turn interactive off for run > >>> x = 2 # interactive setting is restored > > But of course, you can use the interactive / is_interactive functions > in any script or interactive session. > > To make this more accessible, perhaps we should add an interactive (or > update) kwarg to plot and friends, in the same vein that we discussed > a kwarg for hold, so you can easily do things like > > plot(x, y, hold=False) # add plot, clearing previous > plot(x, y, update=False) # add plot but do not update > > But the question arises, does the additional complexity in the > matplotlib internals required to support this justify the savings for > the occasional user who would otherwise have to type a couple of extra > lines? > In this case I don't think so. the function interactive() is what I was looking for, not a keyword argument. Unlike overplotting, I think interactive() is likely to be used almost entirely in scripts and functions and that is by far the better approach. So it's already good enough as far as I'm concerned. Perry > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |