Ask Your Question
4

In-line graphics for Sage in ipython notebook?

asked 2014-02-04 10:20:55 +0100

sswatson gravatar image

I am running Sage on a local machine (OS X Mavericks) from an ipython notebook. Everything works fine except that I don't have pretty printing or in-line graphics (2D or 3D) -- the graphics launch in Preview.app. Is it possible to obtain either of these features in the ipython notebook interface?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
1

answered 2014-02-04 12:13:49 +0100

ppurka gravatar image

I don't have ipython notebook installed either system wide or in sage. Perhaps the instructions in the following website helps?

http://pub.ist.ac.at/~jguzman/doc/pro...

edit flag offensive delete link more

Comments

Thanks for the link. I put the suggested lines in my init file, but they only apply to figures generated through matplotlib (not plots generated using the Sage plot command).

sswatson gravatar imagesswatson ( 2014-02-04 15:58:20 +0100 )edit

You can post this in sage-support. I don't know of any trivial way to do this.

ppurka gravatar imageppurka ( 2014-02-04 19:51:41 +0100 )edit

I have the same question here. Hope there is a way to solve it.

Han gravatar imageHan ( 2014-09-28 18:02:55 +0100 )edit
1

answered 2015-05-19 18:50:04 +0100

eric_g gravatar image

Hi,

With a recent version of Sage (at least 6.6, but 6.7 (released 2 days ago!) is recommended), 2D and 3D inline plots in the IPython notebook work nicely when the notebook is started by the command

sage -n ipython
edit flag offensive delete link more

Comments

Fantastic!!!! tested in Sage 6.7, it works like a charm!

jguzman gravatar imagejguzman ( 2015-05-19 19:27:14 +0100 )edit
0

answered 2015-05-19 13:53:17 +0100

jguzman gravatar image

updated 2015-05-19 14:04:18 +0100

The link points to my website, which I recently updated. The only way I found at the moment to plot inline was to enter this in the IPython notebook:

 %load_ext sage
 from IPython.display import display, Image
 x = var('x')
 plot(sin(x), 0, 2*pi, figsize=4).save('/tmp/foo.png')
 display(Image('/tmp/foo.png')
edit flag offensive delete link more

Comments

tested with Sage 6.7

jguzman gravatar imagejguzman ( 2015-05-19 13:53:58 +0100 )edit
0

answered 2024-11-30 07:40:10 +0100

you can try this

x = var('x')

p1 = plot(sin(x**Integer(2)), (x, Integer(0), Integer(6)), axes_labels=[r'$\theta$', r'$\sin(\theta^2)$'], fontsize=Integer(16))

p2 = plot(x**Integer(3), (x, Integer(1), Integer(100)), axes_labels=[r'$x$', r'$y$'], scale='semilogy', frame=True, gridlines='minor')

ga = graphics_array([p1, p2])

ga.matplotlib(figsize=(8., 5.))

edit flag offensive delete link more

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: 2014-02-04 10:20:55 +0100

Seen: 1,496 times

Last updated: Nov 30