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.Fri, 21 Jun 2013 11:45:56 +0200open a plot window from sage-consolehttps://ask.sagemath.org/question/10268/open-a-plot-window-from-sage-console/I have sage notebook working perfectly on my Mac (including plots of course).
now I would like to use the sage-shell too. I use the **-ipython -pylab** options but when I try to draw anything, using for instance:
x=randn(1000); hist(x)
or
f = plt.figure()
plt.plot(range(10),range(10))
plt.show()
nothing happend. Nevetheless if I ask for plt.savefig('blahblah.png') I have the image on my disk...
what did I messed?
very strange...
sage: f1 = lambda x:1
sage: f2 = lambda x:1-x
sage: f3 = lambda x:exp(x)
sage: f4 = lambda x:sin(2*x)
sage: f = Piecewise([[(0,1),f1],[(1,2),f2],[(2,3),f3],[(3,10),f4]])
sage: f.plot()
with the **-pylab** option alone works, it seems that **-ipython** is to blame; any idea?Fri, 21 Jun 2013 11:22:45 +0200https://ask.sagemath.org/question/10268/open-a-plot-window-from-sage-console/Answer by kcrisman for <p>I have sage notebook working perfectly on my Mac (including plots of course).
now I would like to use the sage-shell too. I use the <strong>-ipython -pylab</strong> options but when I try to draw anything, using for instance:</p>
<pre><code>x=randn(1000); hist(x)
</code></pre>
<p>or</p>
<pre><code>f = plt.figure()
plt.plot(range(10),range(10))
plt.show()
</code></pre>
<p>nothing happend. Nevetheless if I ask for plt.savefig('blahblah.png') I have the image on my disk...</p>
<p>what did I messed?</p>
<p>very strange...</p>
<pre><code>sage: f1 = lambda x:1
sage: f2 = lambda x:1-x
sage: f3 = lambda x:exp(x)
sage: f4 = lambda x:sin(2*x)
sage: f = Piecewise([[(0,1),f1],[(1,2),f2],[(2,3),f3],[(3,10),f4]])
sage: f.plot()
</code></pre>
<p>with the <strong>-pylab</strong> option alone works, it seems that <strong>-ipython</strong> is to blame; any idea?</p>
https://ask.sagemath.org/question/10268/open-a-plot-window-from-sage-console/?answer=15111#post-id-15111You probably will have to set `SAGE_MATPLOTLIB_GUI` and rebuild matplotlib (probably `sage -f matplotlib`). See [the installation guide](http://www.sagemath.org/doc/installation/source.html).Fri, 21 Jun 2013 11:45:56 +0200https://ask.sagemath.org/question/10268/open-a-plot-window-from-sage-console/?answer=15111#post-id-15111