Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include matplotlib html5 canvas rendering to sage #9471

Open
williamstein opened this issue Jul 10, 2010 · 0 comments
Open

include matplotlib html5 canvas rendering to sage #9471

williamstein opened this issue Jul 10, 2010 · 0 comments

Comments

@williamstein
Copy link
Contributor

See http://code.google.com/p/mplh5canvas/

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.

CC: @jasongrout

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/9471

@williamstein williamstein added this to the sage-5.11 milestone Jul 10, 2010
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants