Ask Your Question

No png when using a file

asked 2021-08-02 13:44:39 +0100

ypcman gravatar image

Hi, I'm using SageMath version 9.3, Release Date: 2021-05-09 If I write in my terminal :

x = var('x')
f(x)= x**2
print('hello 2')

The 2 hello are printed and also the graphic in a png. If I write these 5 rows in a file .sage and use 'load' or 'attach', only the 2 hello are printed but no png graphic ... Thanks for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-02 14:53:15 +0100

slelievre gravatar image

There are two ways to go:

  • use show to make the png display in the default viewer
  • use save to save it to a file

Try with:

plot(f, -4, 4).show()
plot(f, -4, 4).save('plot_square_function.png')
edit flag offensive delete link more


It works perfectly ! Thanks a lot

ypcman gravatar imageypcman ( 2021-08-02 20:48:35 +0100 )edit

Good. To mark your question as solved, you can click the "accept" button next to the answer.

slelievre gravatar imageslelievre ( 2021-08-02 23:52:46 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2021-08-01 22:46:43 +0100

Seen: 88 times

Last updated: Aug 02 '21