Skip to content

Visualizing Plots Generated on a Remote Server

pmagwene edited this page Oct 21, 2014 · 3 revisions

Occasionally you'll find yourself in the situation that you want to run a bunch of analyses on a remote server, but you want to generate some visualizations on your local laptop/desktop machine. One solution is to get whoever administers the remote server to setup RStudio Server; however this isn't always possible. A "light weight" solution is to use secure shell (SSH) along with a X-windows server to forward X11 windows from the remote server to your local machine (X11 is the "windowing" system on most Unix operating systems).

If you're on a Mac, the standard X11 server is called XQuartz, which can be freely downloaded.

On Windows, there are a number of options, both free and commercial. Duke site licenses a commercial X11 server for Windows called Xwin32, which you can download from the OIT site license site (https://oit.duke.edu/comp-print/software/). Free alternatives include Xming and MobaXterm.

Once you've downloaded and installed the X11 server, you can ssh to the remote machine as shown below, adding the -X option to enable X11 forwarding:

ssh -X username@remoteserver.org

Once you've logged into the remote server, you can test that X11 forwarding is working correctly by starting up the R (or IPython) interpreter and generating a plot:

> x <- 1:10
> plot(x, x**2)

If everything is working correctly, an X11 window should open up on your local machine, showing the expected plot.

Clone this wiki locally