Mike Hansen wrote: > Hi Gus, > > On Sat, Mar 7, 2009 at 8:26 AM, linuxgus <ka8...@amsat.org> wrote: >> In notebook, after importing pylab, running something like >> >> pylab.plot([1,2,3],[1,2,3]) >> pylab.show() >> >> does nothing. Doing it from the command line results in a cryptic >> message about using matplotlib.use() to declare a GUI backend. Can >> somebody show me how make pylab.plot() and pylab.show() work in >> notebook? > > In order to get that to work in the notebook, you don't want to use > pylab.show(). Instead, you'll want to use pylab.savefig('fig.png') > which will save the plot to a png file. The notebook will then > automatically detect that a png file has been created and > automatically display it in the browser. >
There is some preliminary work to wrap matplotlib figures in Graphics objects, so you could do: Graphics(pylab.plot(...)) and Sage would treat it like any other Sage graphics object (i.e., you could add it to other things, etc.) See http://trac.sagemath.org/sage_trac/ticket/5128 There is still a problem with the posted patch which I'm sure would be easy for someone familiar with matplotlib to fix. If you know how (or if anyone knows how) to get the min/max x-coordinates and the min/max y-coordinates of generic matplotlib figure/object/whatever would be passed in, that is what is still needed. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---