[R] How to add the value on the barchart
John Kane
jrkrideau at yahoo.ca
Sat Nov 22 18:02:30 CET 2008
Try something like the code below. Unfortunately I cannot remember who wrote the code.
=======================================================================
my.values=100000:100005
x <- barplot(my.values, ylim=c(0,110000))
text(x, my.values, "wibble", pos=3) # always does what you want
# whereas:
text(x, 0.6+my.values, "wibble") # doesn't look very nice
=============================================================
--- On Fri, 11/21/08, Piya Kittipadakul <kittipadakul at yahoo.com> wrote:
> From: Piya Kittipadakul <kittipadakul at yahoo.com>
> Subject: [R] How to add the value on the barchart
> To: r-help at r-project.org
> Received: Friday, November 21, 2008, 7:14 PM
> I have question: how can I put the value on the bar chart.
> This my code:
> barchart(Tuberize~Family|factor(Year)*factor(Hr),data=tuber)
>
> This's my data:
> Year Hr Family Tuberize
> 1 2007 20 A 0.26
> 2 2007 20 B 6.08
> 3 2007 20 C 0.00
> 4 2007 20 D 0.27
> 5 2008 20 A 1.18
> 6 2008 20 B 9.17
> 7 2008 20 C 0.00
> 8 2008 20 D 2.13
> 9 2007 14 A 35.83
> 10 2007 14 B 38.98
> 11 2007 14 C 7.90
> 12 2007 14 D 18.75
> 13 2008 14 A 43.70
> 14 2008 14 B 51.84
> 15 2008 14 C 27.11
> 16 2008 14 D 24.11
> 17 2008 11 A 85.67
> 18 2008 11 B 93.73
> 19 2008 11 C 81.45
> 20 2008 11 D 90.25
> 21 2007 8 A 63.04
> 22 2007 8 B 66.29
> 23 2007 8 C 70.85
> 24 2007 8 D 83.48
> 25 2008 8 A 83.33
> 26 2008 8 B 92.31
> 27 2008 8 C 82.21
> 28 2008 8 D 94.03
>
> Thank you
> Piya
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
__________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
More information about the R-help
mailing list