[R] Abline in dotplot
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Wed May 16 21:22:30 CEST 2007
Thompson, Valeria V said the following on 5/16/2007 12:04 PM:
> Hello,
>
> I have trouble adding an abline to a dotplot() from "lattice" package.
> For example, I would like to draw a line at x=3:
>
>> library(lattice)
>> x<-1:5
>> names(x) <- c("a", "b", "c", "d", "e")
>> dotplot(sample(x))
>> panel.abline(v=3)
>
> Produces a line on the left hand side of the origin. What would be a
> correct way to do this?
>
> Thank you,
>
> Valeria V. Thompson
> Applied Statistics Group
> Mathematics & Computing Technology
> The Boeing Company
> (425) 373-2740
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Try this instead:
library(lattice)
x<-1:5
names(x) <- c("a", "b", "c", "d", "e")
dotplot(sample(x),
panel = function(...) {
panel.dotplot(...)
panel.abline(v=3)
})
HTH,
--sundar
More information about the R-help
mailing list