I have a xyplot
and I want to draw grid lines on the 0 values.
How this can be done?
There is a lattice llines function that replaces the function of lines() functionality in base. There is also a panel.lines function.
#---------- method --------------
xyplot(-1:1 ~ -1:1, type="l")
trellis.focus("panel", 1, 1)
do.call("panel.abline", list(h=0,v=0, lty=3) )
trellis.unfocus()
# --- that method has the advantage of also demonstrating
# how to modify an existing plot
#---------- method 2--------------
xp <-xyplot(-2:1 ~ -2:1, type="l", panel=function(...){
panel.xyplot(...)
panel.abline(h=0,v=0, lty=3)} )
xp