[R] adding grid lines to an xyplot when there is only 1 panel - corrected

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu May 18 20:16:42 CEST 2006


On 5/18/06, ken knoblauch <knoblauch at lyon.inserm.fr> wrote:
> Sorry, some things got garbled in that request for help that might make
> my request
> unintelligible, probably it being too late at night when I posted, here
> is the corrected function
> call for which I would like to learn how to add horizontal grid lines.
> Any suggestions
> would be appreciated.  Apologies for the posting error
>
> xyplot(est ~ STE, data = all, groups = AREA, type = "b",
>    		auto.key = list(space = "right"))

Write your own panel function, e.g.

xyplot(est ~ STE, data = all, groups = AREA, type = "b",
       panel = function(...) {
           panel.grid(h = -1, v = 0)
           panel.xyplot(...)
       },
       auto.key = list(space = "right"))

See ?panel.grid for more options.

Deepayan




More information about the R-help mailing list