Re: [R] Abline in dotplot

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed, 16 May 2007 12:22:30 -0700

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



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. Received on Wed 16 May 2007 - 19:40:00 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 Wed 16 May 2007 - 20:33:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.