Interactive plot desiderata collection

20 views
Skip to first unread message

Maurizio

unread,
Feb 26, 2009, 4:14:25 AM2/26/09
to sage-devel
Hi all,

as you know, Kenny and me recently worked on a notebook demo to show
the possibility to include a javascript enhanced plot package (namely
FLOT) into the SAGE notebook.

The demo is currently hosted at: http://www.sagenb.org/pub/285/

As you can see, this is just a proof of concept.
<b>Do any of you have suggestions about features that you would like
to have in another demo? </b> If that can help in convincing the
community to adopt this package, we would be available to produce
another example notebook.

Has anybody here ever worked on javascript and SAGE interaction code?
We would appreciate some help.

As you can see here:
http://groups.google.com/group/sage-devel/browse_thread/thread/91c424ccb670ed4b/8fa944a778a15d35?lnk=gst&q=flot#

Some discussion already went on about this, and it seems that a lot of
people have been positively impressed by the demo, so it seems
reasonable to not let this chance to include this package to go away
without any result.

Please, note that the working demo has been developed in just few
hours, and we are already working with it on a daily basis, so it
seems pretty functional and stable, and it is also easy to maintain
and further enhance.

Anyway, FLOT is actively developed, so it could be a good idea to
later contact its developers to take advantage of their help, or at
least of their knowledge:

http://groups.google.com/group/flot-graphs

Regards

Kenny and Maurizio

Jason Grout

unread,
Feb 26, 2009, 5:56:04 AM2/26/09
to sage-...@googlegroups.com
Maurizio wrote:
> Hi all,
>
> as you know, Kenny and me recently worked on a notebook demo to show
> the possibility to include a javascript enhanced plot package (namely
> FLOT) into the SAGE notebook.
>
> The demo is currently hosted at: http://www.sagenb.org/pub/285/
>
> As you can see, this is just a proof of concept.
> <b>Do any of you have suggestions about features that you would like
> to have in another demo? </b> If that can help in convincing the
> community to adopt this package, we would be available to produce
> another example notebook.
>
> Has anybody here ever worked on javascript and SAGE interaction code?
> We would appreciate some help.
>
> As you can see here:
> http://groups.google.com/group/sage-devel/browse_thread/thread/91c424ccb670ed4b/8fa944a778a15d35?lnk=gst&q=flot#
>
> Some discussion already went on about this, and it seems that a lot of
> people have been positively impressed by the demo, so it seems
> reasonable to not let this chance to include this package to go away
> without any result.


I think the next step might be to make an optional spkg for the flot
code. You can probably just take one of the existing javascript spkgs
(say, the tinymce spkg or the jsmath spkg) and modify it slightly by
putting flot in the src/ directory and changing the documentation. If
you are comfortable trying this, here are instructions:

1. Download the jsmath spkg
2. Extract the spkg (you can do this with tar xjvf jsmath-3.6a.p0.spkg)
3. Change the directory name to flot-VERSION_NUMBER
4. Change the code in the src directory and change the directories
mentioned in the spkg-install file
5. Change the documentation in the SPKG.txt file
6. Delete the existing .hg directory in the flot-VERSION_NUMBER
directory to get rid of the repository for the jsmath spkg
7. Create a new hg repository for the flot spkg by doing sage -hg init
inside of the flot-VERSION_NUMBER directory
8. commit the spkg-install and SPKG.txt files (do "sage -hg add
spkg-install" and "sage -hg add SPKG.txt", then "sage -hg commit" and
type a brief message, like "initial version")
6. do "sage -spkg DIRECTORY"
7. post the resulting flot-VERSIONNUMBER.spkg

Maurizio

unread,
Feb 27, 2009, 4:08:12 AM2/27/09
to sage-devel
I have another question.
What do you think about the SAGE functions that are going to use FLOT?

In my opinion, simply providing a FLOT spkg that adds the javascript,
will not provide any additional feature to the users, because all the
people that would have been capable to write the js powered functions
from scratch wouldn't have been any problem in downloading and using
manually the latest revision of FLOT (or FLOTR, or any other preferred
js plot package).

On the contrary, if we start providing also, let's say, two simple
FLOT powered plot SAGE functions, and do a little advertising on the
wiki (for example), we will get much greater results in terms of user
benefits, and even in long term support of the package, because many
more people would be exposed to the usage of the basic functions, and
there is a lot of people capable of writing complex SAGE plotting
functions, that don't want to deal too much with writing javascript
functions from scratch.

In fact, my enabler in this case has been the Kenny's experience with
javascript and stuff, because I wouldn't be capable of doing this by
myself (even though I already did the bode plot function for
matplotlib).

What do you think?

In case you agree, we would really appreciate some feedback about how
to speedup a bit the SAGE functions.

Regards

Maurizio

On 26 Feb, 11:56, Jason Grout <jason-s...@creativetrax.com> wrote:
> Maurizio wrote:
> > Hi all,
>
> > as you know, Kenny and me recently worked on a notebook demo to show
> > the possibility to include a javascript enhanced plot package (namely
> >FLOT) into the SAGE notebook.
>
> > The demo is currently hosted at:http://www.sagenb.org/pub/285/
>
> > As you can see, this is just a proof of concept.
> > <b>Do any of you have suggestions about features that you would like
> > to have in another demo? </b> If that can help in convincing the
> > community to adopt this package, we would be available to produce
> > another example notebook.
>
> > Has anybody here ever worked on javascript and SAGE interaction code?
> > We would appreciate some help.
>
> > As you can see here:
> >http://groups.google.com/group/sage-devel/browse_thread/thread/91c424...
>
> > Some discussion already went on about this, and it seems that a lot of
> > people have been positively impressed by the demo, so it seems
> > reasonable to not let this chance to include this package to go away
> > without any result.
>
> I think the next step might be to make an optional spkg for theflot
> code.  You can probably just take one of the existing javascript spkgs
> (say, the tinymce spkg or the jsmath spkg) and modify it slightly by
> puttingflotin the src/ directory and changing the documentation.  If
> you are comfortable trying this, here are instructions:
>
> 1. Download the jsmath spkg
> 2. Extract the spkg (you can do this with tar xjvf  jsmath-3.6a.p0.spkg)
> 3. Change the directory name toflot-VERSION_NUMBER
> 4. Change the code in the src directory and change the directories
> mentioned in the spkg-install file
> 5. Change the documentation in the SPKG.txt file
> 6. Delete the existing .hg directory in theflot-VERSION_NUMBER
> directory to get rid of the repository for the jsmath spkg
> 7. Create a new hg repository for theflotspkg by doing sage -hg init
> inside of theflot-VERSION_NUMBER directory
> 8. commit the spkg-install and SPKG.txt files (do "sage -hg add
> spkg-install" and "sage -hg add SPKG.txt", then "sage -hg commit" and
> type a brief message, like "initial version")
> 6. do "sage -spkg DIRECTORY"
> 7. post the resultingflot-VERSIONNUMBER.spkg
>
>
>
> > Please, note that the working demo has been developed in just few
> > hours, and we are already working with it on a daily basis, so it
> > seems pretty functional and stable, and it is also easy to maintain
> > and further enhance.
>
> > Anyway,FLOTis actively developed, so it could be a good idea to

Kenny

unread,
Feb 27, 2009, 4:23:05 AM2/27/09
to sage-devel
During this week end I'll try to put together an spkg with a simple
flot graph
without the pop-up using floating DIS the same as the jsmath. Hope
this
will renew the interest in this interactive plotting. After that it
will be possible to
discuss and investigate the pros and cons of this solution.

Jason Grout

unread,
Feb 27, 2009, 5:37:31 AM2/27/09
to sage-...@googlegroups.com
Maurizio wrote:
> I have another question.
> What do you think about the SAGE functions that are going to use FLOT?


After we have an spkg, I think we should add a 'flot' option to the
viewer argument of the show command that would show the plot using FLOT
if FLOT is installed. Is this the sort of thing that you are thinking?
Then the user would be able to do:

p=plot(x*sin(x), (x,-2,2))
show(p, viewer='flot')

and a FLOT chart would pop up.

Jason

Tom Boothby

unread,
Feb 27, 2009, 12:27:53 PM2/27/09
to sage-...@googlegroups.com
In an ideal world, all graphics objects would have the ability to
render themselves in FLOT. There are currently some issues with this:

1) FLOT doesn't appear to be able to make shapes -- circles, polygons, etc.
2) Graphics objects have an additive structure: (circle + text +
plot).show() works great for now
3) FLOT doesn't support logarithmic or polar plotting

The first thing I would do would be to add a FLOT rendering option to
plot.show() -- this should be pretty easy, given my adaptation of your
code in

http://groups.google.com/group/sage-devel/browse_thread/thread/91c424ccb670ed4b/2ffcf542cfeaeb64

If you want to take a crack at it, Maurizio, I welcome you to. If you
get stuck, drop me a line; if you give up, definitely tell me because
I want to see this happen badly enough to write it myself. :)

Kenny

unread,
Feb 27, 2009, 2:47:20 PM2/27/09
to sage-devel
I think that it is quite hard to develop a graphic platform that
perform well
displaying both 3D 2D and general graphics... sometimes it is good to
have
some interactive 2D plotting and use other graphical engine for
complex
diagram such as polar or smith chart.

Apart from this consideration I like flot not because it is nice to
see, but
because having a JS data instead of a static png will allow to zoom or
have a crosshair that point the value of the data on mouse over
events, or
to dynamically add and remove line from a plot. This kind of feature
are
not really required when your presenting your work, but I think that a
lot
of user, like me, that comes from the matlab world would enjoy such
graphic interaction... even without 3D capabilities.

Sorry I did not mean to be polemic, was just a bunch of consideration
at the end of the day (Rome Time :)), apart from that could you please
point
out again your code

(http://groups.google.com/group/sage-devel/browse_thread/thread/
91c424ccb670ed4b/2ffcf542cfeaeb64)

to crack the plot.show function., maybe I can work a little bit on
that!

On 27 Feb, 18:27, Tom Boothby <tomas.boot...@gmail.com> wrote:
> In an ideal world, all graphics objects would have the ability to
> render themselves in FLOT.  There are currently some issues with this:
>
> 1) FLOT doesn't appear to be able to make shapes -- circles, polygons, etc.
> 2) Graphics objects have an additive structure: (circle + text +
> plot).show() works great for now
> 3) FLOT doesn't support logarithmic or polar plotting
>
> The first thing I would do would be to add a FLOT rendering option to
> plot.show() -- this should be pretty easy, given my adaptation of your
> code in
>
> http://groups.google.com/group/sage-devel/browse_thread/thread/91c424...
>
> If you want to take a crack at it, Maurizio, I welcome you to.  If you
> get stuck, drop me a line; if you give up, definitely tell me because
> I want to see this happen badly enough to write it myself.  :)
>
> On Fri, Feb 27, 2009 at 2:37 AM, Jason Grout
>

Robert Bradshaw

unread,
Feb 27, 2009, 2:51:16 PM2/27/09
to sage-...@googlegroups.com
On Feb 27, 2009, at 9:27 AM, Tom Boothby wrote:

> In an ideal world, all graphics objects would have the ability to
> render themselves in FLOT. There are currently some issues with this:
>
> 1) FLOT doesn't appear to be able to make shapes -- circles,
> polygons, etc.
> 2) Graphics objects have an additive structure: (circle + text +
> plot).show() works great for now
> 3) FLOT doesn't support logarithmic or polar plotting

It would be nice if FLOT was used at a lower level (e.g. the
discussion of a matplotlib backend), that way everything that works
now will seemlessly work with FLOT too, rather than having to support
things one at a time.

Kenny

unread,
Feb 27, 2009, 2:59:11 PM2/27/09
to sage-devel
I think I'm missing the point, is a canvas matplolib backend able to
work
as client side plotting render?? I've seen the @interact method and
with it I
was able to change the zoom level moving a slider, that is quite
enough,
but it has a drawback, every time you move the slider the client will
request the
server a new image, and it is quite slow.

Don't hesitate to reply even if you don’t agree with my position, If
somebody
will show me a simple way to have a client side matplotlib I will be
happy to
work on that!


On 27 Feb, 20:51, Robert Bradshaw <rober...@math.washington.edu>
wrote:

Robert Bradshaw

unread,
Feb 27, 2009, 3:05:20 PM2/27/09
to sage-...@googlegroups.com
I do know that matplotlib works with dynamic backends, so I would
imagine it would be able to do the job without a constantly poling
the server.

Jaap Spies

unread,
Feb 27, 2009, 3:20:39 PM2/27/09
to sage-...@googlegroups.com
Kenny wrote:
> I think that it is quite hard to develop a graphic platform that
> perform well
> displaying both 3D 2D and general graphics... sometimes it is good to
> have
> some interactive 2D plotting and use other graphical engine for
> complex
> diagram such as polar or smith chart.
>

Did you ever look at the enthought tool suite?
Interactive 2D and 3D plots (vtk based). Chaco and Mayavi2.
Mayavi2 has a module mlab which has some matlab features:

http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/mlab_reference.html

I made some experimental spkgs (linux only for the moment), see:
http://sage.math.washington.edu/home/jsp/SPKGS/ETS/

For an example animation:
http://sage.math.washington.edu/home/jsp/animations/anim_surf.mov

Installing the spkgs is not for the faint harted :(!

Cheers,

Jaap

Maurizio

unread,
Feb 27, 2009, 4:12:51 PM2/27/09
to sage-devel
Guys,
sorry to miss this very interesting conversation, but I'll be out of
town for work during the next week, and I should really be going to
prepare the luggage right now! ;) My flight departs in 12 hours, and I
should sleep a little bit as well.

Hopefully, I'll catch on this next week

Enjoy!!

Maurizio

On 27 Feb, 21:05, Robert Bradshaw <rober...@math.washington.edu>
wrote:

Jason Grout

unread,
Feb 27, 2009, 4:36:12 PM2/27/09
to sage-...@googlegroups.com
Kenny wrote:
> I think I'm missing the point, is a canvas matplolib backend able to
> work
> as client side plotting render?? I've seen the @interact method and

I think so. I see the canvas backend as behaving like the normal GUI
backends to matplotlib, which allow panning, zooming, picking points,
etc. The infrastructure is already there in matplotlib. Someone just
needs to write code that:

* Renders a path, given a bunch of points
* Renders text
* handles user events and passes them back to matplotlib (hmmm...we
want to avoid that round-trip, so maybe we might have to restrict
ourselves to panning/zooming...)


It seems interesting to also make a FLOT backend to matplotlib, so that
the paths and text given actually write FLOT javascript code to render
the plot. Basically, instead of rendering a png, you'd be rendering to
code for a FLOT instance.

Jason

Kenny

unread,
Feb 27, 2009, 6:37:57 PM2/27/09
to sage-devel
Now I understand wot you mean when you say matplotlib backend! :)
sorry eventually I got the point... anyway thats great, using the same
code that matplotlib use, and at the end be able to decide to plot a
pretty
png, render a javascript that uses FLOT or maybe a good PDF for
inclusion
in latex document... or even better using same pstrick and output
directly the graph into latex...

I will open the matplob lib code and I'll try to understand how it
manage
the varoius backends and hopefully write a simple FLOT render... just
for fun and to see if the community like it!

Kenny

unread,
Feb 27, 2009, 6:49:51 PM2/27/09
to sage-devel
Quite impressive... I'm used to the 3D surface plot that cames out
from
mathcad and matlab, this seem to be on another level. I've downloaded
the spkg but now I don't feel brave enough to install it, I will try
it on my
ubuntu box tomorrow, this a thing that works better during the day!

On 27 Feb, 21:20, Jaap Spies <j.sp...@hccnet.nl> wrote:
> Kenny wrote:
> > I think that it is quite hard to develop a graphic platform that
> > perform well
> > displaying both 3D 2D and general graphics... sometimes it is good to
> > have
> > some interactive 2D plotting and use other graphical engine for
> > complex
> > diagram such as polar or smith chart.
>
> Did you ever look at the enthought tool suite?
> Interactive 2D and 3D plots (vtk based). Chaco and Mayavi2.
> Mayavi2 has a module mlab which has some matlab features:
>
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/http://code.enthought.com/projects/mayavi/docs/development/html/mayav...

Jaap Spies

unread,
Feb 27, 2009, 7:24:41 PM2/27/09
to sage-...@googlegroups.com
Kenny wrote:
> Quite impressive... I'm used to the 3D surface plot that cames out
> from
> mathcad and matlab, this seem to be on another level. I've downloaded
> the spkg but now I don't feel brave enough to install it, I will try
> it on my
> ubuntu box tomorrow, this a thing that works better during the day!
>

Sure! If you have problems ask! The dependencies are quite complicated.

Another animation:
http://sage.math.washington.edu/home/jsp/animations/anim_mesh.mov

Cheers,

Jaap

Reply all
Reply to author
Forward
0 new messages