[R] xyplot and separate abline per plot

Sébastien Bihorel sbihorel at buffalo.edu
Fri Jun 27 16:23:50 CEST 2008


Hi Karin,

Try this

xyplot(numbers~sqrt(breaks)|moltype+disttype,
groups = type,
data = alldata,

panel = function(x, y, ...){
panel.abline(h = 0, col.line = 1)
panel.xyplot(x, y, ...,
pch = 1,
col.symbol = 1)})

Look at panel.abline in the lattice help for more details. Here, "h = 0" 
will plot a horizontal line at y = 0 in each of your panels. Similarly, 
"v = 0" will plot a vertical line at x = 0 in each of your panels. You 
will need to build a vector to plots these lines at different coordinates.

Sebastien



More information about the R-help mailing list