[R] R plotting on linux, regardless of architecture of local machine

Marc Schwartz marc_schwartz at me.com
Fri Jun 4 23:30:06 CEST 2010


On Jun 4, 2010, at 3:26 PM, vaneet wrote:

> 
> So just so I understand properly,  if there are multiple users connecting to
> this remote linux machine in which I installed R and lets just say they all
> have Windows machines.  To view plots they would all need to have an SSH
> client and an X server installed on their local machine to do this?  You
> said that X11 is the default graphic device on Linux, isn't there some way
> of using X11 in R to show the plot while logged in to the remote linux
> machine?
> 
> Thanks


There are two separate functions required:

1. SSH Client - This provides the ability to login securely to the RHEL server from a remote client system. That could be another Linux/Unix machine, a Windows machine or an OSX machine (could even be a smartphone). This, in isolation, strictly provides a text based, point-to-point encrypted communication mechanism for the two machines to interact, over some network connection (could be the internet). 

It provides the functional equivalent of you sitting at the server itself and logging in locally using text mode only. Since it is a remote connection, SSH encrypts the connection to provide for the security of the data going back and forth over the network connection.

On a PC, think of the old DOS command line interface before Windows came along.

With respect to R, you need the SSH client to connect to the RHEL server to be able to run R. R is not running (executing) on your Windows machine. R is actually running on the RHEL server and the SSH connection is providing the means to transmit your keystrokes to the server and to provide the text mode screen output back to you. So the SSH network connection is essentially providing really long cables between your keyboard, your display and the server.


2. X11 - Linux uses X11 to provide the basic substrate for creating the GUI or windowing functionality on the display. This provides the basic means of graphical interaction with the computer as we generally know it today. When R generates plots in response to your commands, the RHEL server needs to send the results (signal) back to you and your computer needs the ability to interpret those signals and display them on your machine.  It is the X11 server (eg. Xming) running on your computer, that interprets those signals and enables the plot to be displayed on your machine. Without the X11 server running on your machine, all you have is a text based interaction with the RHEL server, because Windows would not know what to do with the signals coming from the RHEL server. 

If you are familiar with the difference between NTSC (aka Never The Same Color) and PAL, this would be something of a parallel. They are both TV display signal standards, but are not compatible.


Now, in reality, there is another component here, called X11 port forwarding. Think call forwarding. We have to have some way for the RHEL server to know to send (forward) the signals for the plot, over the SSH connection, to your machine, rather than sending them to the display that is physically connected to the RHEL server. Otherwise, you won't see the plot on your end.

In order to accomplish this, the RHEL server has to be configured to support this functionality (your SysAdmin will know how to do this) AND the SSH client needs to be configured to support the connection as well. In PuTTY for example, there is a setting in the application that enables this. But remember, this has to be supported on both ends, so you need to check with your SysAdmin. Sometimes, because of security concerns, X11 port forwarding will be disabled on the RHEL server side of things.

I see that Ted has also provided an excellent reply, so hopefully this might supplement his in some fashion.

HTH,

Marc Schwartz



More information about the R-help mailing list