[R] Vertical line in densityplot?

Gustaf Rydevik gustaf.rydevik at gmail.com
Fri Dec 1 07:45:12 CET 2006


Hi all,

I'm trying to get a vertical line at a specific point in a
densityplot. abline seems to be what's required, but it doesn't align
itself to the scale used in the plot.

example:

library(lattice)
x<-rnorm(100)
plot.new()
densityplot(x)
abline(v=0)
-----
The line seems to use some other coordinate system. What kind of call
do I use to make abline use the graph's coordinates?

Additionally, it would be nice to have standard xy-axis, and to have
the line stop at the x-axis, so if anyone could tell me how to do
that, I'd be grateful.

Thanks in advance,

Gustaf


PS: a minor question: Why do I have to call plot.new() for abline to work?

-- 
email:gustaf.rydevik at gmail.com
tel: +46(0)703051451
address: Kantorsgatan 50:190 75424 Uppsala Sweden




More information about the R-help mailing list