Can't seem to be able to cycle through 2D figures as in ipython (alone)

7 views
Skip to first unread message

Ben Racine

unread,
Dec 16, 2010, 6:29:13 PM12/16/10
to spyd...@googlegroups.com
I am trying to cycle through figure ranges, but no lines are plotted
in the figure box until after I have finished cycling through.

for i in seq(0,1):
plot(x[i,:],y[i,:])
show()
raw_input("hit a key")

This is possible through my bare-bones ipython install, but not
through spyder's ipython console.

I am using: WinXP64, Spyder 2.0.5, ipython 0.10.1, Python 2.6.6, Qt
4.6.2, PyQt 4.7.4

Any ideas as to what could be the source of this behavior?

Regards,
Ben R.

Pierre Raybaut

unread,
Dec 17, 2010, 4:44:43 AM12/17/10
to spyder
Are you sure that you have tested this code in the exact same
conditions on Spyder's IPython console and on the regular IPython
shell? I'm guessing that the backend of your regular IPython install
is Tkinter, not Qt as in Spyder. And the behavior that you are
describing is probably a bug of the Matplotlib's Qt backend (I've
reproduced the same behavior on both Spyder's IPython and my external
IPython which is configured to use the Qt backend).

josef...@gmail.com

unread,
Dec 17, 2010, 6:24:18 AM12/17/10
to spyd...@googlegroups.com
On Fri, Dec 17, 2010 at 4:44 AM, Pierre Raybaut
<pierre....@gmail.com> wrote:
> Are you sure that you have tested this code in the exact same
> conditions on Spyder's IPython console and on the regular IPython
> shell? I'm guessing that the backend of your regular IPython install
> is Tkinter, not Qt as in Spyder. And the behavior that you are
> describing is probably a bug of the Matplotlib's Qt backend (I've
> reproduced the same behavior on both Spyder's IPython and my external
> IPython which is configured to use the Qt backend).
>
> On Dec 17, 12:29 am, Ben Racine <i3enha...@gmail.com> wrote:
>> I am trying to cycle through figure ranges, but no lines are plotted
>> in the figure box until after I have finished cycling through.
>>
>> for i in seq(0,1):
>>     plot(x[i,:],y[i,:])
>>     show()
>>     raw_input("hit a key")

I don't think show() is supposed to used this way. I still have
matplotlib 0.99.1 and I don't know if this has changed, but the
recommendation was to use show() only once in a script. I think there
is a draw() command for this purpose or something like it, that can be
used in a loop.

(I always need to go through the matplotlib examples to figure out how
to do it.)

Josef

>>
>> This is possible through my bare-bones ipython install, but not
>> through spyder's ipython console.
>>
>> I am using: WinXP64, Spyder 2.0.5, ipython 0.10.1, Python 2.6.6, Qt
>> 4.6.2, PyQt 4.7.4
>>
>> Any ideas as to what could be the source of this behavior?
>>
>> Regards,
>> Ben R.
>

> --
> You received this message because you are subscribed to the Google Groups "spyder" group.
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
>
>

Carlos Córdoba

unread,
Dec 19, 2010, 11:12:01 AM12/19/10
to spyd...@googlegroups.com
There are two ways to obtain what you want:

1. As Pierre says here, you can use the Tkinter backend for matplotlib,
instead of the Qt one. I've tried it and it really works.

2. As Pierre mentioned in issue 459

http://code.google.com/p/spyderlib/issues/detail?id=459

you can add QApplication.processEvents() inside your for loop, but
please use it with care because (according to matplotlib devs) it can
cause segfaults. This alternative works for me too.

Carlos

El 17/12/10 04:44, Pierre Raybaut escribió:

Reply all
Reply to author
Forward
0 new messages