On Monday, May 30, 2011, Eric O LEBIGOT (EOL)
<[email protected]> wrote:
>
> Thank you for your response.
>
>
> Benjamin Root-2 wrote:
>>
>> On Sunday, May 29, 2011, Eric O LEBIGOT (EOL)
>> <[email protected]> wrote:
>>>
>>> What does ion() exactly do?
>>>$$$
>>> from matplotlib import pyplot as pp
>>>
>>> pp.plot([10, 20, 50])
>>> pp.draw()
>>>
>>> raw_input('Press enter...') # No graph displayed?!!
>>>$$$
>>
>> Turning interactive mode on also means an implied "show" command, if
>> needed. The first program can replace draw() with show(). However,
>> if interactive mode is off, then the python execution pauses. With it
>> on, python execution will continue.
>>
> So, if anything is drawn when interactive mode is off, does one *have* to
> use show() at the end? in other words does using a single raw_input() at
> the end of the program force the use of the interactive mode for *all*
> figures? (Closing all the figures with a simple "enter" is very convenient,
> but having a performance penalty for this would not be so nice…).
>
Yes, if interactive mode is off, and you want to view the figures, you
need show(). No, the raw_input does nothing in either case.
> Now, if I understand you correctly, I have another question. I don't
> understand anymore what draw() does: in fact, it is not necessary in
> interactive mode, and it does not appear to do anything in non-interactive
> mode, since show() is really the function that really displays the figures.
> So, why does matplotlib offer draw()? what does it really do?
>
The draw() command is used for some more advanced features such as
animations and widgets, as well as for internal use. I rarely use
draw() in my scripts.
May I suggest reading the FAQ and some of the example scripts on the
website in order to demonstrate the different ways to use mpl?
Ben Root
> EOL
>
> PS: Here is an example: the following code does *not* display the first
> figure (Matplotlib 1.0.0 on Mac OS X with the GTKAgg backend):
Off the top of my head, this is either a bug that has been fixed, or
is intended behavior. Turning interactive mode on after having made a
figure might be confusing pyplot. Calling show at anytime will
produce the intended behavior. show() is your friend.
> $$$
> from matplotlib import pyplot as pp
>
> pp.figure()
> pp.plot([10, 20, 50])
> pp.draw() # Will not be displayed despite the draw()
>
> pp.ion() # Interactive mode on
> pp.figure()
> pp.plot([100, 20, 10])
>
> raw_input('Press enter...') # Only the second graph is displayed
> $$$
> --
> View this message in context:
> http://old.nabble.com/Exact-semantics-of-ion%28%29---tp31728909p31731176.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users