s-news
[Top] [All Lists]

Re: Customizing Trellis plots

To: uszata@and.pl, s-news@lists.biostat.wustl.edu
Subject: Re: Customizing Trellis plots
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Tue, 30 Nov 2004 00:59:51 -0500
## Most of what you want can be done with standard trellis arguments.
## See ?trellis.args for details.

tmp <- data.frame(XX=rnorm(27),
                  YY=rnorm(27),
                  x=factor(rep(LETTERS[1:3],9)),
                  y=factor(rep(LETTERS[24:26],c(9,9,9))))

xyplot(YY ~ XX | x*y, data=tmp)

xyplot(YY ~ XX | x*y, data=tmp,
       strip=FALSE,
       scales=list(x=list(alternating=1), y=list(alternating=2))
       )


## Labeling the Rows and Columns of the scatterplot matrix can be done
## with panel.cartesian from the HH library.

xyplot(YY ~ XX | x*y, data=tmp,
       strip=FALSE,
       scales=list(alternating=T, labels=F, ticks=F, cex=1),
       panel=panel.cartesian,
       axis3.line=0)

## I wrote panel.cartesian for a specific task; see Figure 4.16 on
## page 83 for the example.  It doesn't generalize as cleanly as I
## would like.  Generalizing it is on my todo list.  The argument
## axis3.line is a tuning parameter.  The conditioning factors must be
## named "x" and "y".
## 
## When you download the files from the website below, you can see Figure
## 4.16 as grap/figure/grap.f7.eps.gz

## For information on the HH library, please go to the website for our
## book
##                Statistical Analysis and Data Display
##                Richard M. Heiberger and Burt Holland
## at
##                http://springeronline.com/0-387-40270-5




## An alternate way to label the Rows and Columns, using only standard
## graphics commands, requires more work from the user.

xyplot(YY ~ XX | x*y, data=tmp,
       strip=FALSE,
       scales=list(x=list(alternating=1), y=list(alternating=2)),
       ylab=""
       )
mtext(side=3, levels(tmp$x), at=c(.175, .5, .825), line=3.5)
mtext(side=2, levels(tmp$y), at=c(.175, .5, .825), line=4)
mtext(side=4, "YY", line=1)

<Prev in Thread] Current Thread [Next in Thread>