i installed sage with conda: conda create -n sage sage python=3.12
everything works perfectly but plots won't show in jupyter notebooks:
c=circle((0,0), 1, rgbcolor=(1,1,0))
c.show()
i can save plots with command:
c.save('filename.png')
in a python script i tried:
from sage.all import *
# Define a variable and a function
x = var('x')
f = sin(x) * exp(-0.1 * x)
# Create the plot (Sage wraps matplotlib under the hood)
p = plot(f, (x, -10, 10), color='blue', legend_label='sin(x)*e^(-0.1x)', figsize=6)
# Show the plot
p.show()
This does not work either:
from sage.all import *
import matplotlib.pyplot as plt
x = var('x')
f = sin(x) * exp(-0.1 * x)
p = plot(f, (x, -10, 10), color='blue', legend_label='sin(x)*e^(-0.1x)', figsize=6)
# Convert Sage plot to matplotlib figure and show
fig = p.matplotlib()
plt.show()
Code compiles with no error.