Hello all,
I want to draw a grid behind my graphes, using lattice package.
I manage to do it with instructions like this one :
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
data = iris, allow.multiple = TRUE, scales = "same",type="l",
panel = function(...) { panel.grid(h=-1, v= -1) ;
panel.superpose(...)
}
)
I was wondering if there were a way to do it using for example
trellis.par.set() to set this by default, like what I do for colors e.g. :
trellis.par.set(list(superpose.line = list(col = c( "red", "yellow",
"green", "blue", "purple", "orange", "black", "maroon", "pink", "cyan",
"grey", "magenta" ))))
instead of using in each call this log panel = function (...) { }
instruction
I tried emprirically
trellis.par.set(list(grid.pars= list(h = -1, v=-1)))
with no success (I am not even sure that this grid.pars is about drawing
grids ... but it is the nearest instruction i found in trellis parameters
As i am not very confident with this trellis.par.set(), I might have missed
something ... I also tried to define a function
grid<-function(...) { panel.grid(h=-1, v= -1) ; panel.superpose(...) }
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
data = iris, allow.multiple = TRUE, scales = "same",type="l",
panel = grid() #also tried grid(...)
)
but the only result is an arror message
with grid() : " Erreur dans unit(y0, default.units) : 'x' et 'units' doivent
avoir une longueur positive " (x and units should have a positive length)
with grid(...) : " '...' utilisé dans un contexte incorrect " ('...' used in
a wrong context)
Could anyone tell me a way of doing it ?
--
Pascal Boisson
[EMAIL PROTECTED]
http://pak.enroweb.com
http://www.flickr.com/photos/hoothootprod/
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.