If I start Sage 8.0 notebook using the jupyter notebook (sage -n jupyter
), and run either of the following code in a cell:
%matplotlib inline
import matplotlib.pyplot as plt
x = [1,2,3]
y = [-1,1,0]
plt.plot(x, y, 'bo-')
plt.show()
or
%matplotlib inline
import matplotlib.pyplot as plt
x = [1,2,3]
y = [-1,1,0]
plt.plot(x, y, 'bo-')
plt.savefig('xxx.png')
Both do not result in a plot. Instead the output is:
π΅πππππ(πΊπΉπΈπ‘πΈπΎπΎ)
On the other hand, if I run Sage 8.0 using the old notebook (sage -n sagenb
), this code results in a plot in a separate windows:
import matplotlib.pyplot as plt
x = [1,2,3]
y = [-1,1,0]
plt.plot(x, y, 'bo-')
plt.show()
While this code results in a plot inline:
import matplotlib.pyplot as plt
x = [1,2,3]
y = [-1,1,0]
plt.plot(x, y, 'bo-')
plt.savefig('xxx.png')
How do I get a matplotlib plot to appear inline when I am using Sage in a Jupyter notebook? I've already installed the tk and tk-dev libraries as mentioned in the installation guide and reinstalled the matplotlib library using sage -f matplotlib
after running export export SAGE_MATPLOTLIB_GUI=yes
.