From: Eric J. <jo...@MI...> - 2008-11-21 16:20:06
|
I've looked through the latest examples as well as google and the list archives, and am still at a loss -- can anyone point me to an example of how to animate a scatter plot? The collection returned by scatter() lacks anything akin to a set_data method. Thanks! ...Eric |
From: Eric B. <eri...@gm...> - 2008-11-21 16:47:13
Attachments:
animation.py
|
Hi Eric, > > On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote: >> I've looked through the latest examples as well as google and the list >> archives, and am still at a loss -- can anyone point me to an example of >> how to animate a scatter plot? I've attached a somewhat unpolished but functional example that shows time-synchronized animation of multiple scatter plots. It uses the wx backend explicitly, due to some issues with the idle event handling. >> The collection returned by scatter() lacks anything akin to a set_data method. Yup, you want this instead: collection.set_offsets(xy) collection.set_array(s) -Eric |
From: Cohen-Tanugi J. <co...@lp...> - 2008-11-23 23:23:06
|
> hi, I tried your script, commenting/uncommenting the backend line, but > I still get: > [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py > --------------------------------------------------------------------------- > > AttributeError Traceback (most recent call > last) > > /home/cohen/MACROS/animation.py in <module>() > 274 p.show() > 275 > --> 276 t = test() > 277 > 278 > > /home/cohen/MACROS/animation.py in __init__(self) > 270 > 271 # cid = p.gcf().canvas.mpl_connect('idle_event', > self.update) > --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update) > 273 > 274 p.show() > > AttributeError: 'NoneType' object has no attribute 'Bind' > WARNING: Failure executing file: <MACROS/animation.py> > > I am using MPL revision 6440. > cheers, > Johann > > Eric Bruning wrote: >> Hi Eric, >> >>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote: >>> >>>> I've looked through the latest examples as well as google and the list >>>> archives, and am still at a loss -- can anyone point me to an >>>> example of >>>> how to animate a scatter plot? >>>> >> >> I've attached a somewhat unpolished but functional example that shows >> time-synchronized animation of multiple scatter plots. It uses the wx >> backend explicitly, due to some issues with the idle event handling. >> >> >>>> The collection returned by scatter() lacks anything akin to a >>>> set_data method. >>>> >> >> Yup, you want this instead: >> collection.set_offsets(xy) >> collection.set_array(s) >> >> -Eric >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win >> great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Eric B. <eri...@gm...> - 2008-11-25 01:44:28
Attachments:
animation.py
|
Strange, strange. iPython is apparently having some effect here: I tried ipython -pylab animation.py and I got a figure with the initial plot, but nothing further happened. After closing the plot, I typed run animation.py at the ipython prompt, and saw the initial plot, erasure, and animation that I expected. Can you try running with a plain python animation.py I've attached a new version of the script with some changes suggested offline by Ryan May - he was seeing platform or wx-specific behavior related to event handling. All bugs remaining are mine :) -Eric On Sun, Nov 23, 2008 at 6:20 PM, Cohen-Tanugi Johann <co...@lp...> wrote: > >> hi, I tried your script, commenting/uncommenting the backend line, but I >> still get: >> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py >> >> --------------------------------------------------------------------------- >> AttributeError Traceback (most recent call >> last) >> >> /home/cohen/MACROS/animation.py in <module>() >> 274 p.show() >> 275 >> --> 276 t = test() >> 277 >> 278 >> >> /home/cohen/MACROS/animation.py in __init__(self) >> 270 >> 271 # cid = p.gcf().canvas.mpl_connect('idle_event', >> self.update) >> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update) >> 273 >> 274 p.show() >> >> AttributeError: 'NoneType' object has no attribute 'Bind' >> WARNING: Failure executing file: <MACROS/animation.py> >> >> I am using MPL revision 6440. >> cheers, >> Johann >> >> Eric Bruning wrote: >>> >>> Hi Eric, >>> >>>> >>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote: >>>> >>>>> >>>>> I've looked through the latest examples as well as google and the list >>>>> archives, and am still at a loss -- can anyone point me to an example >>>>> of >>>>> how to animate a scatter plot? >>>>> >>> >>> I've attached a somewhat unpolished but functional example that shows >>> time-synchronized animation of multiple scatter plots. It uses the wx >>> backend explicitly, due to some issues with the idle event handling. >>> >>> >>>>> >>>>> The collection returned by scatter() lacks anything akin to a set_data >>>>> method. >>>>> >>> >>> Yup, you want this instead: >>> collection.set_offsets(xy) >>> collection.set_array(s) >>> >>> -Eric >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the >>> world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > |
From: Cohen-Tanugi J. <Joh...@lp...> - 2008-11-25 09:23:16
|
indeed it works with python now, provided I uncomment the wxAgg setting in the script. best, Johann Eric Bruning wrote: > Strange, strange. iPython is apparently having some effect here: I tried > ipython -pylab animation.py > and I got a figure with the initial plot, but nothing further > happened. After closing the plot, I typed > run animation.py > at the ipython prompt, and saw the initial plot, erasure, and > animation that I expected. Can you try running with a plain > python animation.py > > I've attached a new version of the script with some changes suggested > offline by Ryan May - he was seeing platform or wx-specific behavior > related to event handling. All bugs remaining are mine :) > > -Eric > > On Sun, Nov 23, 2008 at 6:20 PM, Cohen-Tanugi Johann > <co...@lp...> wrote: > >>> hi, I tried your script, commenting/uncommenting the backend line, but I >>> still get: >>> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py >>> >>> --------------------------------------------------------------------------- >>> AttributeError Traceback (most recent call >>> last) >>> >>> /home/cohen/MACROS/animation.py in <module>() >>> 274 p.show() >>> 275 >>> --> 276 t = test() >>> 277 >>> 278 >>> >>> /home/cohen/MACROS/animation.py in __init__(self) >>> 270 >>> 271 # cid = p.gcf().canvas.mpl_connect('idle_event', >>> self.update) >>> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update) >>> 273 >>> 274 p.show() >>> >>> AttributeError: 'NoneType' object has no attribute 'Bind' >>> WARNING: Failure executing file: <MACROS/animation.py> >>> >>> I am using MPL revision 6440. >>> cheers, >>> Johann >>> >>> Eric Bruning wrote: >>> >>>> Hi Eric, >>>> >>>> >>>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote: >>>>> >>>>> >>>>>> I've looked through the latest examples as well as google and the list >>>>>> archives, and am still at a loss -- can anyone point me to an example >>>>>> of >>>>>> how to animate a scatter plot? >>>>>> >>>>>> >>>> I've attached a somewhat unpolished but functional example that shows >>>> time-synchronized animation of multiple scatter plots. It uses the wx >>>> backend explicitly, due to some issues with the idle event handling. >>>> >>>> >>>> >>>>>> The collection returned by scatter() lacks anything akin to a set_data >>>>>> method. >>>>>> >>>>>> >>>> Yup, you want this instead: >>>> collection.set_offsets(xy) >>>> collection.set_array(s) >>>> >>>> -Eric >>>> ------------------------------------------------------------------------ >>>> >>>> ------------------------------------------------------------------------- >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>> challenge >>>> Build the coolest Linux based applications with Moblin SDK & win great >>>> prizes >>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>> world >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>> ------------------------------------------------------------------------ >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> |