On Mon, Jun 21, 2010 at 7:32 PM, Robert Bradshaw <rober...@math.washington.edu> wrote: > On Jun 21, 2010, at 8:12 AM, Jason Grout wrote: > >> Some people have just released a preliminary version of an html5 canvas >> matplotlib backend. What this means is cool interactive 2d graphics for >> Sage. If anyone wants to look at it and see how it works, the code is up >> here: >> >> http://code.google.com/p/mplh5canvas/ > > Very cool. Seems to be based on callbacks, which should be natural for those > used to using twisted. >
Let's include this in Sage soon. I just tried it out for fun on my laptop: (1) Grab and extract the tarball from here: http://code.google.com/p/mplh5canvas/downloads/list then install it with "sage -python setup.py install" (2) Install netifaces: sage -sh easy_install netifaces exit (3) In the Sage notebook, or command line, paste something like this: import matplotlib matplotlib.use('module://mplh5canvas.backend_h5canvas') from pylab import * import time """Simple static plot, mostly for testing zooming... """ clf() theta = arange(0,8*pi,0.1) a=1 b=.2 for dt in arange(0,2*pi,pi/2.0): x = a*cos( theta+dt )*exp(b*theta) y = a*sin( theta+dt )*exp(b*theta) dt = dt+pi/4.0 x2 = a*cos( theta+dt )*exp(b*theta) y2 = a*sin( theta+dt )*exp(b*theta) xf = concatenate( (x,x2[::-1]) ) yf = concatenate( (y,y2[::-1]) ) p1=fill(xf,yf) show() Basically, you can put nearly any example from the matplotlib website before show (and after clf()) and it will "just work". What happens above is that a new server is started and the plot displayed in it. Figuring out how to use our existing twisted server for interaction could be a nontrivial but very import challenge. This is now trac 9471: http://trac.sagemath.org/sage_trac/ticket/9471 -- William -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org