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.Thu, 05 Jan 2012 05:23:41 +0100no more inline matplotlib plots in sage notebookhttps://ask.sagemath.org/question/8608/no-more-inline-matplotlib-plots-in-sage-notebook/Hi,
I can't get any matplotplib/pylab plots inline in a notebook. Plots now are created as pdf files that open in another window.
For example, the code below used to create the plot in a new box after the instruction plt.savefig('.')
import numpy as np
import pylab as plt
x = np.arange(-2 * np.pi, 2 * np.pi,0.1)
plt.figure(1)
plt.clf()
plt.plot(x, np.sin(x), label='sin(x)')
plt.savefig('.')
now it returns a link '.pdf' to a pdf file.
Using
plt.savefig('a.png')
returns the following traceback:
Traceback (most recent call last):
File "", line 1, in <module>
File "/private/var/folders/k7/k7XHz3-82RazCk+kNOj55U+++TM/-Tmp-/tmpjD4zHK/___code___.py", line 14, in <module>
exec compile(u"plt.savefig('a.png')" + '\n', '', 'single')
File "", line 1, in <module>
File "/tmp/sage-mac-app/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 363, in savefig
return fig.savefig(*args, **kwargs)
File "/tmp/sage-mac-app/local/lib/python2.6/site-packages/matplotlib/figure.py", line 1084, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/tmp/sage-mac-app/local/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1853, in print_figure
print_method = self._get_print_method(format)
File "/tmp/sage-mac-app/local/lib/python2.6/site-packages/matplotlib/backend_bases.py", line 1793, in _get_print_method
'%s.' % (format, ', '.join(formats)))
ValueError: Format "png" is not supported.
Supported formats: pdf.
I don't know what settings changes I may have done, and couldn't find any documented help format settings in sage for matplotlib plots. Interestingly I used to experience before the impossibility to export sage generated plots in pdf... It would be nice to have a better control on these settings.
Thank you for any help
Samuel
sbottThu, 05 Jan 2012 05:23:41 +0100https://ask.sagemath.org/question/8608/