Searched archives and found some old email threads on the topic. But mot exactly what I think I need. Suppose I have a datafile such as tmp.

tmp <- data.frame(var1 = c(rnorm(1000), rnorm(1000, 1, 1)), var2 = gl(2, 1000))

I'd like a plot similar to the one below, but with an abline of v=0 in the lower panel and v=1 in the upper panel. Code below creates two lines in each panel, not quite sure how to separate them by panel.

densityplot(~ var1|var2, tmp,
                              type = c('g', 'l'),
                              layout = c(1,2),
                                             panel = function(x, ...){
                                             panel.densityplot(x, ...)
                                             panel.abline(v = c(0,1))
                                             }
)

Thank you
Harold

	[[alternative HTML version deleted]]

