[R] Data Labels in a barchart (Lattice or otherwise)

RaoulD raoul.t.dsouza at gmail.com
Mon Jul 5 19:14:52 CEST 2010


Thank You David. Yes, I am using the lattice barchart and have managed to add
data labels, however, they tend to be on the tip of each bar and are
difficult to read as they are partially on the bar. Any help would be
greatly appreciated.

This is the code I am using:
 levels(PR_SUMMARY$Bucket)=c("0-3 months","3-9 months","9-15 months","15-18
months")
 barchart(PrimaryReason ~ cInteractions| Bucket + Type, data = PR_SUMMARY,
layout = c(4, 2),col="lightgreen",main="COMPARISON - PRIMARY REASON",
           sub="L & R",xlab="Number of Customers",ylab="Primary Reasons",
           auto.key = list(title = "COMPARISON - PRIMARY
REASON",columns=2,points = FALSE, rectangles =          TRUE,space= "right"
),scales = list(x = list(abbreviate=TRUE,minlength=5,rot=45)),
           panel = function(x,y,subscripts,groups,...){
                panel.barchart(x,y,...)
                ltext(x,y,label=round(PR_SUMMARY$cInteractions,1),
cex=.99,rot=45)
                border="transparent"}) 

I dont really understand the "ltext" part and found it with some other code,
but it works.

Thanks again,
Raoul
-- 
View this message in context: http://r.789695.n4.nabble.com/Data-Labels-in-a-barchart-Lattice-or-otherwise-tp2278027p2278646.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list