Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
3

How to get Sage 8.0 to plot matplotlib plots inline and typeset expressions on a Jupyter notebook?

asked 7 years ago

ensaba gravatar image

updated 2 years ago

tmonteil gravatar image

If I start Sage 8.0 notebook using the jupyter notebook (sage -n jupyter), and the following code:

from numpy import arange, sin, pi

import matplotlib.pyplot as plt

X = arange(0.0, 2*pi, 0.01)

plt.plot(X, sin(X))

plt.show()

x + 1

The plot displays inline but the expression x+1 is not typeset.

If I run the following code:

%display typeset


from numpy import arange, sin, pi

import matplotlib.pyplot as plt

X = arange(0.0, 2*pi, 0.01)

plt.plot(X, sin(X))

plt.show()

x + 1

Then, the plot does not display inline. It shows:

π™΅πš’πšπšžπš›πšŽ(𝟺𝟹𝟸𝚑𝟸𝟾𝟾)

However, the expression x+1 is in typeset.

How can I have both the matplotlib plots display inline and expressions typeset?

Preview: (hide)

1 Answer

Sort by Β» oldest newest most voted
1

answered 7 years ago

tmonteil gravatar image

I can reproduce the bug, thanks for reporting, this is now trac ticket 23566.

What you can do until this is fixed is to change display inbetween :

%display simple

from numpy import arange, sin, pi
import matplotlib.pyplot as plt
X = arange(0.0, 2*pi, 0.01)
plt.plot(X, sin(X))
plt.show()

%display typeset

x+1
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: 7 years ago

Seen: 978 times

Last updated: Aug 01 '17