s-news
[Top] [All Lists]

Re: Variable Y panel plots without guiPlot?

To: Sarah Henderson <sarah.henderson@ubc.ca>, s-news@lists.biostat.wustl.edu
Subject: Re: Variable Y panel plots without guiPlot?
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Thu, 14 Jul 2005 23:33:59 -0400
## This can easily be done using the xysplom function from our recent book
## 
##  Statistical Analysis and Data Display: An Intermediate Course with 
##  Examples in S-Plus, R, and SAS 
## by 
##  Richard M. Heiberger and Burt Holland 
## 
## You can get information and the online files at 
## 
##  http://www.springeronline.com/0-387-40270-5 
## 
## We are teaching a short course based on our book at the Joint
## Statistics Meetings in Minneapolis on Monday August 8, 2005.

## You will need to download our files in order to reproduce the attached
## graph.


panel.test <- function(x, y, ...) {

  cell <- get("cell", frame=sys.parent())
  if (cell==1) {
    panel.xyplot(x, y, ..., type="l")
    axis(side=2, las=1)
  }
  
  if (cell==2) {
    panel.xyplot(x, y, ..., type="p")
    axis(side=2, at=seq(0,315,45))
    axis(side=4, at=seq(0,315,90), labels=c("N","E","S","W"))
  }

}

tmp <- data.frame(time=1:16, direction=rep(seq(0,315,45), 2), speed=sample(16))
tmp


## xysplom is in the HH library
xysplom(speed + direction ~ time, data=tmp,
        panel=panel.test,
        xlab="date range",
        ylab="",
        scales.in=list(
          x=list(relation="same", alternating=FALSE),
          y=list(relation="free", alternating=FALSE, yaxt="n")),
        par.strip.text=list(cex=1.3))

image/pjpeg

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