On Wed, Mar 2, 2011 at 4:50 PM, John Hunter <jdh2...@gmail.com> wrote:
> On Wed, Mar 2, 2011 at 4:43 PM, Brian Granger <ellisonb
>> The main issue I have is that I am working with undergraduate students
>> who have no experience installing things from scratch.  In this
>> context I am stuck with whatever is in EPD.  Currently EPD is at
>> 1.0.1, which does not have animation.  Will this file "just work" with
>> 1.0.1 or 0.99.3?  I don't have any aversion to using animation.py, I
>> just need to be able to use it within a stock recent EPD.
>
> With EPD and mpl 1.0.1, the new API should work if you drop
> animation.py into your site-packages, eg as mpl_animation.py,and
> import it like
>
>  import mpl_animation as animation
>
> Then later they can just change this to
>
>  import matplotlib.animation as animation
>
> Let us know if you have any troubles with this approach.
>
> I've attached a double pendulum example which is fun, and illustrates
> how to animate multiple objects, a line instance for the pendulum and
> a text instance for the time counter.

I trust you're going to check in that completely awesome example.

Brian, if you're still adverse to using an external module (I
understand), 1.0.1 does have the new timer infrastructure that will
work with the event loop properly. Here's your example converted to
taht:

from pylab import *

def update_line(line):
    line.set_ydata(sin(x+line.counter/10.0))  # update the data
    line.counter += 1
    draw()
    if line.counter > 200:
        return False

x = arange(0,2*pi,0.01)            # x-array
line, = plot(x,sin(x))
line.counter = 0 # Store the counter on the line object

# Get the current figure and get it to create a new timer.
fig = gcf()
timer = fig.canvas.new_timer(interval=50)
timer.add_callback(update_line, line)
timer.start()
show()

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to