Ask Your Question
1

Graphic not shown in PyCharm

asked 2021-07-02 12:24:13 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-07-02 17:55:24 +0100

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

edit flag offensive delete link more

Comments

Thank you very much Lisandra. It worked!

zplot gravatar imagezplot ( 2021-07-03 17:55:31 +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

1 follower

Stats

Asked: 2021-07-02 12:24:13 +0100

Seen: 215 times

Last updated: Jul 02 '21