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, 09 Oct 2020 01:50:44 +0200How to set the matplotlib backend used by plot()https://ask.sagemath.org/question/53794/how-to-set-the-matplotlib-backend-used-by-plot/SageMath uses `matplotlib` as its graphics engine and the module itself can work with many backends. But how can I set a GUI matplotlib backend to be used by the `plot()` function and its friends, at least in the command-line interface? And is there a way to set a default backend?
In my setup, `plot()` doesn't respect the backend set by the `%matplotlib` magic, but `matplotlib.pyplot.plot()` does. Even worse, the default backend creates a PNG image file and opens it in the system's viewer.
I'm on macOS 10.13 "High Sierra" running SageMath 9.1, the binary app version.leogamaFri, 09 Oct 2020 01:50:44 +0200https://ask.sagemath.org/question/53794/open 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?lehalleFri, 21 Jun 2013 11:22:45 +0200https://ask.sagemath.org/question/10268/