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

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Sat 16 Jul 2005 - 03:16:36 EST

On 7/15/05, ftorrei2@uiuc.edu <ftorrei2@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



R-help@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 Received on Sat Jul 16 03:23:33 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:45 EST