Hi,

the notebook (sagelite) can work with Graphics primitives in Sage,
that's very nice.

I would like to make sympy (and other packages) to be able to easily
work with the plotting. One way to do plotting is to use matplotlib
(or anything else) and drop a .png file, the notebook will show it.

But I think a better way is to just return a Graphics object, as described at:

http://sagemath.org/doc/reference/sage/plot/plot.html

since the notebook can plot that one too. That would work for 2D
plots. For 3D plots, Sage seems to be using a little bit different
architecture:

sage: G = plot3d(lambda x, y: x^2 + y^2, (-2,2), (-2,2))
sage: type(G)
<type 'sage.plot.plot3d.parametric_surface.ParametricSurface'>

as described at:

http://sagemath.org/doc/reference/plot3d.html


What is the best way to get other packages using it too? So that they
play nicely with the notebook and also with Sage, if the user install
them in Sage, but also outside Sage, if the user wants to use just the
package + notebook, or even a command line, in which case it should
popup a matplotlib window (and mayavi window in 3D for me).

I think the way to do it would be that the library (be it sympy or
anything else) would have some plot command/method, that returns an
instance,

G = plot(something)

that has some common API, e.g. a

G._plot_()

method and the Sage notebook would check if the returned object has
such a method and if so, just call it to produce a plot, it could
accept a parameter, like

G._plot_(method="notebook")

that would produce a .png image, or

G._plot_(method="commandline")

that would popup a matplotlib/mayavi/whatever window. It seems to me
that in Sage, the G._plot_ method is actually called G.show() and
G.save() ?


As to handling different axes/zoom in/out, in Sage, the G object has
methods like .xmax() and it seems to work nice.
But that is a business of the G object, as far as Sage is concerned,
as long as the object has _plot_ method (or "show", whatever the name
is), it just calls it?

So we just need to support this API and that's it. Is show() and
save() the only two methods we need to implement? Or is there anything
else?

Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to