[R] Putting value labels inside the bars of a bar plot

Liaw, Andy andy_liaw at merck.com
Thu Nov 14 03:29:19 CET 2002


Try something like:

> bar.center <- barplot(x)
> text(bar.center, x, x)

Adjust second argument to text() to get the labels where you want them.
Look at the "Value" section of the "barplot" help page.

HTH,
Andy

-----Original Message-----
From: Tom Arnold [mailto:tarnold at smpllc.com]
Sent: Wednesday, November 13, 2002 6:22 PM
To: R-Help
Subject: [R] Putting value labels inside the bars of a bar plot


I'd like to label a bar plot with the actual value of each bar, inside the
bar. I see that there are ways to plot arbitrary text, so I could do it
'manually', but this seems common enough that there's probably a simple
solution. I don't see it in the high-level documentation for barplot, and
haven't found it anywhere yet. How might this be done?

Thanks,
Tom

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list