[R-SIG-Mac] Re: graphs, X11 and others

Don MacQueen macq at llnl.gov
Thu Dec 9 21:57:19 CET 2004


At 1:42 PM -0500 12/9/04, Simon Urbanek wrote:
>On Dec 9, 2004, at 11:10 AM, Tiago R Magalhaes wrote:
>
>>Thanks again for all your help. I am writing a summary to send 
>>tothe mailing list about my problems and how to solve them. 1) 
>>Briefly Iinstalled X11 and it works now. 2)I downloaded GhostScript 
>>from fink,have it on my computer, but bitmap() still can't find it.
>Make sure it's on the PATH. If you had used i-Installer then it 
>would be on the PATH already...
>
>If you used fink to install gs, then this is more easily said than 
>done, because it heavily depends on where you use it from. But I 
>assume that you want to use it from R, so the most reliable thing to 
>do is to create a symlink in /usr/local/bin, because R automatically 
>adds that directory to the PATH.
>
>First, you have to find out where gs lives - I guess it should be 
>somewhere in /sw as that's what fink uses by default. Let's say you 
>find it in /sw/bin/gs then what you need to do is to type in 
>Terminal:
>
>sudo ln -s /sw/bin/gs /usr/local/bin/gs
>
>if it complains that /usr/local/bin doesn't exist, then type
>sudo mkdir -p /usr/local/bin
>and repeat the above - that should give you gs in R

The documented way to tell R how to find the ghostscript executable 
(see ?bitmap) is to set the environment variable R_GSCMD.
I personally would tend to prefer this, because it doesn't require 
mucking about with system directories.

So, first, outside of R, verify the location of the gs command.

[228]% which gs
/sw/bin/gs

Then inside R, before using bitmap(),

>  Sys.putenv(R_GSCMD='/sw/bin/gs')

Then, for example,

>  bitmap(file='foo.png')
>  hist(runif(100))
>  dev.off()

And since this is OS X, quit R and at the unix prompt

open foo.png

And it will open in Preview.

<- the remainder of previous emails omitted ->

-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA



More information about the R-SIG-Mac mailing list