Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suppose you have a local Linux (Ubuntu) operating system installed on your desktop/laptop (eg : you don't use a SMC terminal).

fill your test.sage with these lines :

g = plot(x^2, (x,-2,2)) 
save(g,'/tmp/dom.png',axes=False,aspect_ratio=True) 
os.system('display /tmp/dom.png')

then execute (if 'sage' command is in PATH):

sage test.sage

A window opens (because you have a X server running in your Linux OS) displaying the PNG file.

You need to have 'imagemagick' installed un order to use display command (last line of the script) .. eg sudo apt-get install imagemagick