An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20041001/06bbb967/attachment.pl
controlling colour in Trellis histogram
5 messages · Bill Shipley, Chuck Cleland, Deepayan Sarkar +1 more
Does this help?
mydata <- data.frame(OPTIMISM =
c(29,35,26,22,30,37,29,32,25,35,38,33,41,28,40),
PARENTS = rep(c("Both Deceased", "One Deceased",
"Both Alive"), c(4,5,6)))
library(lattice)
trellis.device(width=7, height=5, new = FALSE, col = FALSE, bg = "white")
histogram(~ OPTIMISM | PARENTS, data=mydata)
Bill Shipley wrote:
Hello. I am sorry for posting a (seemingly) simple question, but I have just spent 2 hours trying to find the answer, without success. I want to make a histogram with conditioning on a factor, using Trellis graphics. However, I do not want any colours (only black and white) either in the histograms or in the strip. There must be some simple argument but I can??t find it. Here is my code so far:
histogram(~GRC.SLA|as.factor(species.type),data=group.means,
+ strip=function(...)
+
strip.default(...,style=1,factor.levels=c("Conifers","Trees","Herbs","Mo
nocots")))
As a default, this produces the bars in a pale blue and the strip in
orange-yellow.
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
On Friday 01 October 2004 09:16, Bill Shipley wrote:
Hello. I am sorry for posting a (seemingly) simple question, but I have just spent 2 hours trying to find the answer, without success. I want to make a histogram with conditioning on a factor, using Trellis graphics. However, I do not want any colours (only black and white) either in the histograms or in the strip. There must be some simple
trellis.device(color = FALSE) ## assuming you want the default device. ## See ?trellis.device for more options histogram(<...>) Deepayan
Dear bill, Try opening the Trellis graphics device with trellis.device(color=FALSE). I hope this helps, John
-----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Bill Shipley Sent: Friday, October 01, 2004 9:17 AM To: R help list Subject: [R] controlling colour in Trellis histogram Hello. I am sorry for posting a (seemingly) simple question, but I have just spent 2 hours trying to find the answer, without success. I want to make a histogram with conditioning on a factor, using Trellis graphics. However, I do not want any colours (only black and white) either in the histograms or in the strip. There must be some simple argument but I can??t find it. Here is my code so far:
histogram(~GRC.SLA|as.factor(species.type),data=group.means,
+ strip=function(...)
+
strip.default(...,style=1,factor.levels=c("Conifers","Trees","
Herbs","Mo
nocots"))) As a default, this produces the bars in a pale blue and the strip in orange-yellow. Thanks. Bill Shipley Subject Matter Editor, Ecology North American Editor, Annals of Botany D??partement de biologie, Universit?? de Sherbrooke, Sherbrooke (Qu??bec) J1K 2R1 CANADA Bill.Shipley at USherbrooke.ca <http://callisto.si.usherb.ca:8080/bshipley/> http://callisto.si.usherb.ca:8080/bshipley/ [[alternative HTML version deleted]]
______________________________________________ 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
On Friday 01 October 2004 09:25, Chuck Cleland wrote:
Does this help?
mydata <- data.frame(OPTIMISM =
c(29,35,26,22,30,37,29,32,25,35,38,33,41,28,40),
PARENTS = rep(c("Both Deceased", "One
Deceased", "Both Alive"), c(4,5,6)))
library(lattice)
trellis.device(width=7, height=5, new = FALSE, col = FALSE, bg =
"white")
The bg="white" is redundant if color=FALSE. Incidentally, if color=TRUE, setting bg="white" is IMO bad practice (although it seemed like a good idea at the time), since it creates settings with a white background while the other colors are only suitable for a dark background. To make it more difficult for users to achieve this, the 'bg' argument has been dropped from trellis.device in 2.0.0. Deepayan