Skip to content
Prev 179750 / 398502 Next

dotplot: labeling coordinates for each point

Thank you Deepayan! It works perfectly.

Best,
Tony

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Deepayan Sarkar
Sent: Thursday, May 07, 2009 12:20 PM
To: Qifei Zhu
Cc: r-help at r-project.org
Subject: Re: [R] dotplot: labeling coordinates for each point
On Thu, May 7, 2009 at 7:42 AM, Qifei Zhu <zhu_qifei at yahoo.com.sg> wrote:
In that case

dotplot(y ~ x, xlab="Store", ylab="Revenue", main="test",
        scales=list(x = list(draw = FALSE)),
        panel = function(x, y, ...) {
            panel.dotplot(x, y, ...)
            id <- y > 90
            panel.text(as.numeric(x[id]), y[id],
                       labels = sprintf("(%s,%g)", as.character(x[id]), y[id]),
                       pos = 4)
        })

-Deepayan
______________________________________________
R-help at r-project.org 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.