Ask Your Question

plot in sage console, through an ssh connection, with the LiveCd

asked 2012-02-28 04:23:14 -0500

anonymous user


updated 2012-02-29 21:49:15 -0500

I'm a Windows user, and I use sage with the Live Cd, version 4.8.

I use putty.exe to connect to the virtual machine, login as sage, and run the sage console.

I would like to plot from the sage console, through this ssh connection.

I've followed this guide to enable X11forwarding on the VM, and this guide to setup X11forwarding on the Windows machine.

When I run a simple script from within the sage environment like


the plot command returns without any error, but no window is created. I've also tried to run from the bash console, before entering the sage environment, this command:

export DISPLAY=0.0

without any improvement. I actually don't even know if X11 forwarding is working, because I can't find any X program on the livecd like xclock, xeyes, etc. to test them.

EDIT: I've installed xeyes on the live cd, and it doesn't open. Running a netstat or a top, I can't see any sign of the X server running. I think the live CD DOES NOT HAVE AN INSTALLED X SERVER. This settles the question, at least partially. Instead of trying to install the X server on the sage live cd, I'll start with a virtual machine with X preinstalled, and then install Sage. I'll report back here when done.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-02-29 01:31:45 -0500

niles gravatar image

I'm afraid I don't know how to test X11 on Windows, but in the meantime I do know how you can get the images Sage is making. When you run the plot command without specifying a filename to save the plot, Sage generates the file in a temporary location which is deleted when you close the Sage session. That temporary location is stored in the variable SAGE_TMP, so you can type

sage: SAGE_TMP

to see the temporary location.

By the way, temporary files are named by the function tmp_filename(), and you can call that function to see where these files are stored. A related command is tmp_dir(), whose output you will see is similar to tmp_filename().

Alternately, you can simply tell Sage to save the plot in some convenient location:

sage: P = plot(f,(x,0,3))
edit flag offensive delete link more


This info is useful thanks, although it is some sort of workaround. Actually I want to be able to plot figures through ssh to get a better coding experience than the Sage notebook, I'm too used to the command line.

atari gravatar imageatari ( 2012-02-29 21:49:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-02-28 04:23:14 -0500

Seen: 463 times

Last updated: Feb 29 '12