Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

First off, you probably don't need a separate function for that, and secondly you definitely shouldn't clobber the normal Sage plot() function with yours - maybe name it plot1()?

But the real thing you need is to create a file for sagenb to display, with something like

plt.savefig('test.png')

It would be nice to use the temporary filename creation capabilities in Sage but those create filenames in the whole tree; you could do something more annoying like

plt.savefig(os.path.basename(tmp_filename(ext='.png')))

Anyway, I get a nice Lorenz plot so I guess everything works okay! Nice code. I cannot say if this would work with other savefig outputs though as I don't use mpl directly.