tests/methods.R

library(directlabels)
if(require(lattice) && require(nlme)){
  data(BodyWeight, package="nlme")
  oldopt <- lattice.options(panel.error=NULL)
  p <- xyplot(weight~Time|Diet,BodyWeight,groups=Rat,type='l',
              layout=c(3,1),xlim=c(-10,75))
  stop.if.same.colour <- function(d, ...){
    col.tab <- table(d$colour)
    if(1 == length(col.tab)){
      print(d)
      stop("only one colour")
    }
    d
  }
  dl <- direct.label(p, list("angled.boxes", "stop.if.same.colour"))
  print(dl)
  lattice.options(oldopt)
}

Try the directlabels package in your browser

Any scripts or data that you put into this service are public.

directlabels documentation built on Sept. 1, 2023, 9:06 a.m.