[R] lattice xyplot with bty="l"

Patrick Drechsler patrick at pdrechsler.de
Tue Sep 4 22:32:04 CEST 2007


Hi,

what is the correct way of removing the "top" and "right" axes
completely from a lattice xyplot? I would like to have a plot similar
to using the bty="l" option for traditional plots.

An example:

--8<---------------cut here---------------start------------->8---
rm(list=c(ls())) 
library(lattice)

y <- 1:10
x <- y

## Traditional plot:
plot(x, y, bty = "l")

## Lattice plot 1:
xyplot(y ~ x,
       panel = function(x, y, ...){
         panel.xyplot(x, y, ...)
         panel.axis(side = c("left", "bottom"))
       }
       )

## Lattice plot 2:
xyplot(y ~ x,
       ## This just tries to remove all y axes:
       scales = list(y = list(draw = FALSE))
       )
--8<---------------cut here---------------end--------------->8---

Thankful for any pointers,

Patrick



More information about the R-help mailing list