Dear R Gurus Just started on R ! Using xYplot from Hmisc (R 1.9, W2K) I get a grey/blue background that I would like to change to white (ie no background) or may be to another color. Tried to do that with par(bg) but only changed the color of the trellis heading. What's the right command to do that ? Kind regards, JL PS if anyone has nice default settings for win device please let me know. I used win.slide in Splus but apparently this does not work in R.
What you should realize is that xYplot() uses lattice, and that color theme is the default for lattice. trellis.device() has the `theme' argument that you can use to change it. The help page explains how you can change the default: theme: list of components that change the settings of the device opened, or, a function that when called produces such a list. The function name can be supplied as a quoted string. A possible use of this argument is to change the default settings at session startup, for example by setting 'options(lattice.theme = "col.whitebg")'. If 'theme' is a function, it will not be supplied any arguments, however, it is guaranteed that a device will already be open when it is called, so one may use '.Device' inside the function to ascertain what device has been opened. Andy> From: Jean-Louis Abitbol > > Dear R Gurus > > Just started on R ! > > Using xYplot from Hmisc (R 1.9, W2K) I get a grey/blue > background that I > would like to change to white (ie no background) or may be to another > color. > > Tried to do that with par(bg) but only changed the color of > the trellis > heading. > > What's the right command to do that ? > > Kind regards, JL > > PS if anyone has nice default settings for win device please let me > know. I used win.slide in Splus but apparently this does not > work in R. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >
See the bg argument to trellis.device(). Here is an example: library(Hmisc) library(lattice) trellis.device(width=7, height=5, new = TRUE, col = FALSE, bg = "white") dfr <- expand.grid(month=1:12, continent=c('Europe','USA'), sex=c('female','male')) set.seed(1) dfr <- upData(dfr, y=month/10 + 1*(sex=='female') + 2*(continent=='Europe') + runif(48,-.15,.15), lower=y - runif(48,.05,.15), upper=y + runif(48,.05,.15)) xYplot(Cbind(y,lower,upper) ~ month,subset=sex=='male' & continent=='USA', data=dfr) hope this helps, Chuck Cleland Jean-Louis Abitbol wrote:> Dear R Gurus > > Just started on R ! > > Using xYplot from Hmisc (R 1.9, W2K) I get a grey/blue background that I > would like to change to white (ie no background) or may be to another > color. > > Tried to do that with par(bg) but only changed the color of the trellis > heading. > > What's the right command to do that ? > > Kind regards, JL > > PS if anyone has nice default settings for win device please let me > know. I used win.slide in Splus but apparently this does not work in R. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894