Ask Your Question
1

Graphic not shown in PyCharm

asked 3 years ago

zplot gravatar image

Using sage inside a Python program with PyCharm if I write:

q = sage.all.plot(lambda x: x*x, 1, 10)
q.show()

I get in Python console: "Graphics object consisting of 1 graphics primitive" and the program ends well, but the graphic is not shown. On the other hand if I write:

import matplotlib.pyplot as plt
plt.plot([i*i for i in range(10)])
plt.show()

Graphic is perfectly shown in Plots window inside PyCharm. So matplotlib plots are perfectly shown but sage plots are not.

¿How could I get sage plots using PyCharm?

Thank you.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

I had the same problem, I solved it by instead of using .show(), doing a .plot().save('plot.png').

Preview: (hide)
link

Comments

Thank you very much Lisandra. It worked!

zplot gravatar imagezplot ( 3 years ago )

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: 3 years ago

Seen: 244 times

Last updated: Jul 02 '21