Ask Your Question
3

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

asked 2017-07-31 03:29:25 +0100

ensaba gravatar image

updated 2023-01-09 23:59:43 +0100

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?

edit retag flag offensive close merge delete

1 Answer

Sort by Β» oldest newest most voted
1

answered 2017-08-01 18:15:49 +0100

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
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: 2017-07-31 03:29:25 +0100

Seen: 949 times

Last updated: Aug 01 '17