[R] lattice.xyplot: adding grid lines
Marc Mamin
M.Mamin at intershop.de
Tue Sep 9 15:19:18 CEST 2003
Hallo, thank you for your answer,
there is still one problem in your solution:
Sepal.Length + Sepal.Width are considerd as a single serie of data...
Marc Mamin
-----Original Message-----
From: Deepayan Sarkar [mailto:deepayan at stat.wisc.edu]
Sent: Tuesday, September 09, 2003 3:03 PM
To: Marc Mamin; R-help
Subject: Re: [R] lattice.xyplot: adding grid lines
On Tuesday 09 September 2003 04:49, Marc Mamin wrote:
> Hallo,
>
> I'd like to add grid lines to a lattice graph having 2 series of Y data.
>
> See these 2 examples:
>
>
>
> data(iris)
>
> [1]
> xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
> data = iris, allow.multiple = TRUE, scales = "same",type="l",
> )
>
>
> [2]
> xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
> data = iris, allow.multiple = TRUE, scales = "same",type="l",
> panel = function(x, y) {
> panel.grid(h=2, v= 3)
> panel.xyplot(x, y)
> }
> )
>
>
> Question: is it possible to keep all the formats of example [1] (colors,
> type="l", ...), and just add the grids appearing in example 2.
> Moreover I'd like to choose the color of the grid...
Something like this should work:
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
data = iris, allow.multiple = TRUE, scales = "same",type="l",
panel = function(...) {
panel.grid(h=2, v= 3, col="blue")
panel.xyplot(...)
}
)
Deepayan
More information about the R-help
mailing list