ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 03 Jul 2021 17:55:31 +0200Graphic not shown in PyCharmhttps://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/ 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.
Fri, 02 Jul 2021 12:24:13 +0200https://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/Answer by lisandrasp for <p>Using sage inside a Python program with PyCharm if I write:</p>
<pre><code>q = sage.all.plot(lambda x: x*x, 1, 10)
q.show()
</code></pre>
<p>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:</p>
<pre><code>import matplotlib.pyplot as plt
plt.plot([i*i for i in range(10)])
plt.show()
</code></pre>
<p>Graphic is perfectly shown in Plots window inside PyCharm. So matplotlib plots are perfectly shown but sage plots are not.</p>
<p>¿How could I get sage plots using PyCharm? </p>
<p>Thank you.</p>
https://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/?answer=57853#post-id-57853I had the same problem, I solved it by instead of using <code>.show()</code>, doing a <code>.plot().save('plot.png')</code>.
Fri, 02 Jul 2021 17:55:24 +0200https://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/?answer=57853#post-id-57853Comment by zplot for <p>I had the same problem, I solved it by instead of using <code>.show()</code>, doing a <code>.plot().save('plot.png')</code>.</p>
https://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/?comment=57858#post-id-57858Thank you very much Lisandra. It worked!Sat, 03 Jul 2021 17:55:31 +0200https://ask.sagemath.org/question/57850/graphic-not-shown-in-pycharm/?comment=57858#post-id-57858