[R] Sweave and X11 on OSX 10.3

Kieran Healy kjhealy at actewagl.net.au
Wed Jan 7 22:50:47 CET 2004

I see. Unsetting the DISPLAY variable

 % unset DISPLAY  

solves the problem at the terminal.


On 1/8/04 2:52 AM, "Friedrich.Leisch at ci.tuwien.ac.at"
<Friedrich.Leisch at ci.tuwien.ac.at> wrote:

>>>>>> On Tue, 6 Jan 2004 23:44:42 -0700 (MST),
>>>>>> Kieran Healy (KH) wrote:
>> Hi -
>> I'm running R 1.8.1 (compiled from source) on Mac OS X 10.3 (Panther). I
>> find that, if Apple's X11 application is not running, Sweave gives an
>> error when it wants to create a pdf or eps figure. E.g., in the package's
>> own example-1.Snw file a boxplot is created at chunk 2:
>> <<fig=TRUE,echo=FALSE>>=
>> boxplot(Ozone ~ Month, data = airquality)
>> @
>> Normally this will create a pdf and an eps version of the boxplot. I get:
>>> Sweave("example-1.Snw")
>> Writing to file example-1.tex
>> Processing code chunks ...
>>  1 : echo term verbatim
>>  2 : term verbatim eps pdf
>> Warning message:
>> unable to open connection to X11 display`'
>> Error:  chunk 2
>> Error in X11(display, width, height, pointsize, gamma, colortype,
>> maxcubesize,  :
>>         unable to start device X11
>> If I start the X11 application, Sweave runs as normal but displays any
>> figures on an x11() device in addition to creating the eps / pdf files.
>> I don't remember this happening before and experience teaches me to assume
>> the issue is with my own setup rather than Sewave. Maybe there's a
>> problem with the DISPLAY variable, or something that I did while upgrading
>> to Panther -- but I can't see what it is. Has anyone else had this
>> issue?
> Your R session has obviously x11() as the default plotting device
> ... e.g.,
> plot(1:10)
> at the prompt should also give an error, if no graphics device is
> open. I don't know too much about MacOS X, but having the DISPLAY
> variable set without having an X11 server surely means asking for
> trouble on Linux, and I guess MacOS X is not different ...

Kieran Healy, http://www.u.arizona.edu/~kjhealy
Assistant Professor, Sociology Dept, University of Arizona.
Research Fellow, SPT, RSSS, Australian National University.

More information about the R-help mailing list