First time here? Check out the FAQ!

Ask Your Question
1

how to use interactive plot with sage?

asked 0 years ago

nawal gravatar image

Hi,

I've tried both the sage: repl and sage -n jupyter, but in the first case, the plot is a png that gets opened with an image viewer and in the second case it's still an image embedded in the jupyter notebook. Is it possible to do interactive zooming/panning with the mouse at all? It's possible with matplotlib directly in Jupyter and on the repl, you can use qtagg/tkagg/etc. But I can't figure out how to do it with sage.

thanks!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

Emmanuel Charpentier gravatar image

Your description is in essence correct : the interaction with a Sage plot is possible through the notebook.

You may use any Python library by importing the functions of interest, which allows you to use, for example, matplotlib tools. However, since most of these tools use only Python objects, you'll have to wrap any use of Sage-specific objects in wrapper functions converting from Sage to Python and vice-versa. For example, Sage Integers must be coerced to Python's ints, a Sage symbolic function must be wrapped in a Python function, and so on...

Conversely, you may import the needed Sage objects in a Python workspace and create your plots in Python, calling Sage as required. Again, conversion wrappers may be needed.

One may also consider building a Sage SPKG allowing the use of external Python libraries ; such a package may mecome a worthy addition to Sage.

For example, have a look at the interface to Fricas, which allows to use Fricas function and methods from Sage on Sage objects (this interface, which implements the necessary wrappers., is still incomplete, and uses a console-mode interface to a fricas process).

Further discussion of such an implementation may be best done in the Sage mailing lists.

HTH,

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 230 times

Last updated: Nov 07 '24