Re: [R] How to add the value on the barchart

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Sat, 22 Nov 2008 13:05:04 -0500

Following the example in
https://stat.ethz.ch/pipermail/r-help/2006-January/086985.html

You might want to try something like:
 > barchart(Tuberize~Family|factor(Year)*factor(Hr),data=tuber,

+         		panel = function(y,x,...){
+ 			panel.barchart(x,y,...)
+ 			panel.text(x,y,label = tuber$Tuberize, pos=3)
+ 	}
+ )

It still needs some work to increase the ylim so the values are not obscured at the upper ranges of the panels, but this should point you in the right direction.

-- 
David Winsemius

On Nov 21, 2008, at 7:14 PM, Piya Kittipadakul wrote:


> 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.
______________________________________________ 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.
Received on Sat 22 Nov 2008 - 18:11:09 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 Sat 22 Nov 2008 - 20:30:38 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.

list of date sections of archive