Re: [R] adding device size-independent y=0 line to a lattice plot

From: Deepayan Sarkar <>
Date: Mon, 31 Mar 2008 13:04:06 -0700

On 3/31/08, Levi Waldron <> wrote:
> Using the following lattice plot as an example, I would like to add
> horizontal lines where y=0:
> library(lattice)
> library(grid)
> fac <- gl(4,12)
> x <- letters[rep(1:3,16)]
> y <- runif(48,min=0.0)
> dotplot(y~x|fac)
> I've tried it with grid.lines using npc and native units, which works
> fine unless I change the size of the output device - then the lines
> are in the wrong place. Is there a way to do this that is independent
> of the output device size?

The obvious thing to try would be


        panel = function(...) {
            panel.abline(h = 0)

Does this not work?

-Deepayan mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 31 Mar 2008 - 20:06:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 31 Mar 2008 - 20:31:27 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive