[R] pdf() black&white; panel titles in lattice

Chuck Cleland ccleland at optonline.net
Fri Jul 15 20:08:12 CEST 2005


ftorrei2 at uiuc.edu wrote:
> Thank you so much for your help. Now I think I can use R for
> everything I need so far. However I think that I haven't found
> a solution for my first question. trellis.device(color=F) only
> affects the trellis device, but not the pdf device, doesn´t
> it? At least that is my impression. I manage to get black and
> white graphics in trellis, but whenever I switch on the pdf
> device, the resulting pdf file is in color, even if I specify
>  pdf(X.pdf, bg="white", fg="black") (I wonder what the use of
> bg and fg is). The thing is that I need black and white
> graphics for my papers. I am using R on OSX. Does this happen
> to anyone else?

Call trellis.device() after pdf() and use new=FALSE in trellis.device().

pdf("c:/myfolder/myfigures.pdf")
trellis.device(new=FALSE, col=FALSE)

> Thanks again 
> 
> ---- Original message ----
> 
>>Date: Fri, 15 Jul 2005 12:16:36 -0500
>>From: Deepayan Sarkar <deepayan.sarkar at gmail.com>  
>>Subject: Re: [R] pdf() black&white; panel titles in lattice  
>>To: "ftorrei2 at uiuc.edu" <ftorrei2 at uiuc.edu>
>>Cc: r-help at stat.math.ethz.ch
>>
>>On 7/15/05, ftorrei2 at uiuc.edu <ftorrei2 at uiuc.edu> wrote:
>>
>>>Hello,
>>>
>>>I have two questions:
>>>
>>>1. How can I get black and white graphics using the pdf()
>>>device? I have tried pdf(Name.pdf, bg="white", fg"black"), but
>>>I still get  full-color graphics.
>>
>>See ?trellis.device, specifically the 'color' argument.
>>
>>
>>>2. When using lattice, how do I change the title for each
>>>panel?  By default it uses the categories of the grouping
>>>factor. I would like to modify the labels in the graphic
>>>without changing the data. 
>>
>>See the entry for 'strip' in ?xyplot, as well as
> 
> ?strip.default. For
> 
>>one conditioning variable this can be as simple as
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>>   strip = strip.custom(factor.levels = c("I. setosa", 
>>                                 "I. versicolor", "I.
> 
> verginica")))
> 
>>or 
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>>   strip = strip.custom(factor.levels = 
>>       expression(italic("I. setosa"), 
>>                        italic("I. versicolor"), 
>>                        italic("I. verginica"))))
>>
>>
>>
>>>Also, how do I add a title above
>>>the graphic referring to this factor (not the main title of
>>>the graph)? The title for the xlab refers to the independent
>>>factor within each panel. I would like to explain what each
>>>panel represents with something similar to xlab, this title
>>>being above the graphic if possible.
>>
>>You may be satisfied with 
>>
>>xyplot(Sepal.Length ~ Sepal.Width | Species, iris, 
>>         strip = strip.custom(strip.names = TRUE))
>>
>>If not, use the 'key' argument (described in ?xyplot).
>>
>>Deepayan
> 
> Francisco Torreira
> Spanish, Italian and Portuguese
> Univ. of Illinois at Urbana-Champaign
> 707 South Mathews Aven.
> 4031 FLB
> Urbana, IL, 61801
> 
> ______________________________________________
> 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




More information about the R-help mailing list