[R] how to get remote ESS graphics to work?

Matthew Keller mckellercran at gmail.com
Thu May 21 20:04:49 CEST 2009


Hi all,

I got a few comments offline. Here's the final of how to get graphics
remotely using ESS on a mac. It's working fine for us now.

1) change your /etc/sshd_config file. There is a line that reads:
#X11 Forwarding no
change this to:
X11 Forwarding yes
(note no # at start of line)

2) make sure that your .bash_profile files in the remote machine do
not explicitly set DISPLAY. These files live in the user root, i.e.,
~/ (which is the same as /Users/<your user name>/). If you see a line
names "DISPLAY" in this file, this could create problems because you
are explicitly telling X11 where to draw displays. I just erased the
lines in mine, which allows X11 to figure out where to draw displays.

3) Then, from within emacs, type
M-x ssh <return>
then type
-XC username at remote.machine.name <return>
the -X should begin x11 forwarding. The -C compresses the graphics
making the connection much faster

4) then just start R. Make sure to set your options() in R to use x11
rather than the default graphics device (which is quartz on the mac):
> options(device='x11')

5) now when you make graphics, they should appear on your x11 window.

These steps worked for us. Hopefully, they will provide some help to
other ESS Aquamacs Mac users who want to remotely get interactive
graphics. Best,

Matt



On Wed, May 20, 2009 at 5:07 PM, Matthew Keller <mckellercran at gmail.com> wrote:
> Hi all,
>
> I figured out how to get this to work. Not saying this is the best way
> to do it, but it is working for me. The only problem is that the
> graphics are very slow (several seconds to draw hist(rnorm(50))!)
>
> First, I changed both /etc/ssh_config and /etc/ssh_configd to allow
> X11 forwarding (i.e., emacs into those files, find the ForwardAgent
> and ForwardX11 lines, and change these from "no" to "yes").
>
> Then I used the -X option when ssh'ing into the remote machine:
>
> ssh -X myname at remotecomp.
>
> Then I started R remotely. Within the remote R session, I changed the
> default graphics device from 'quartz' to 'x11':
> options(device='x11')
>
> That's it. It is working, but as I said, is surprisingly slow. Not
> sure why that is. Does anyone have more experience with graphics
> remotely? Are they typically slow, or is it my connection, or perhaps
> a setting?
>
> Best,
>
> Matt
>
>
>
> On Wed, May 20, 2009 at 3:13 PM, Matthew Keller <mckellercran at gmail.com> wrote:
>> Hi all,
>>
>> My graduate student is logging onto my macpro and running R through
>> ESS aquamacs (with Mx ssh and then  Mx ess-remote). Everything is
>> working fine until we get to graphing.
>>
>>  We are trying to give him the ability to look at graphics
>> interactively. The ESS manual is not too helpful: "If you run X11 (See
>> Section 13.3.2 [X11], page 68, X-windows) on both the local and remote
>> machines then you should be able to display the graphs locally by
>> setting the ‘DISPLAY’ environment variable appropriately."
>>
>> It's unclear what DISPLAY is appropriate. I have X11 forwarding set up
>> on my machine (the remote machine). When we try to create a graphic in
>> his ESS remote process, (e.g., hist(rnorm(50))), we get the following
>> error:
>> "Error in X11(...
>> unable to start device X11cairo
>> In addition: Warning message:
>> In x11(): unable to open connection to X11 display"
>>
>> Does anyone out there use interactive graphics on their ESS remote
>> sessions? If so, could you provide any help? We're really stuck and
>> just need a step-by-step from anyone who knows.
>>
>> Thank you,
>>
>> Matt
>>
>>
>>
>>
>> --
>> Matthew C Keller
>> Asst. Professor of Psychology
>> University of Colorado at Boulder
>> www.matthewckeller.com
>>
>
>
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com




More information about the R-help mailing list