On 22.07.2011 19:46, pilchat wrote:
Thank you David, the useRaster=T does the trick! But, unfortunately, it
doesn't work for persp.

Is there any way to avoid the sRGB colors at the beginning of the R session?
I tried to edit my Rprofile:

  .First<- function() {
     a<-system("ls /dati/software/R_lib/*.r",intern=T)
     for (i in a) source(i) # my personal functions
     library(MASS)                          # attach a package
#    library(RColorBrewer)
     .ps.prolog<- grDevices:::.ps.prolog
     .ps.prolog[39]<- "/setrgb { setrgbcolor } def"

}

.Last<- function() {
     graphics.off()                        # a small safety measure.
     cat(paste(date(),"\nAdios\n"))        # Is it time for lunch?
}

but it doesn't work either. If I type ".ps.prolog" at the prompt, I get

.ps.prolog
Error: object '.ps.prolog' not found

It seems that the .ps.prolog array is not visible outside the .First()
function.

Moreover, if I comment out "#library(RColorBrewer)", the library is not
available in my R environment: I have to load it manually. The weirdest
thing is that, on the contrary, it works for the MASS package!

Is there something wrong with my Rprofile?


1. If
 library(RColorBrewer)
works depends on where it is installed and where you declare the library to be on the search path.

2. For .ps.prolog, you will have to replace "<-" by "<<-" in this particular case in order to write this to the Workspace. Otherwise it is just a definition within the environment of your .First() call.

3. Alternatively, you may want to consider to add a hook (see ?setHook) so that your redefinition always happens after grDevices is loaded.

Best,
Uwe Ligges




G

On Fri, Jul 22, 2011 at 7:12 PM, James Cloos<cloos+r-h...@jhcloos.com>wrote:

I suspect that a few s/def/bind def/ on that prologue might improve
things a bit.

The ps R creates freely switches between the sRGB ABC space and
setgray.  That is a good thing; it helps ensure that black will
be just black when sent to a CMYK device.  Without that you can
get CMY black from some devices.  But it does complicate things.

(CMYK devices often use CMY black rather than K black when the
source is RGB black because it is better when printing contone
images, such as photographs.  But it just wastes ink and toner
when printing charts and similar graphics.)

The best improvement would be to have R keep track of the last
colorspace and only run the srgb procedure when switching from
DeviceGray, rather than every time it changes the RGB colour.

The SetColor() function in R/src/library/grDevices/src/devPS.c
looks to be the place to do that.  The Invalidate() function
and the PostScriptDesc struct there also need to track any
such changes.

-JimC
--
James Cloos<cl...@jhcloos.com>          OpenPGP: 1024D/ED7DAEA6

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to