The only thing you're missing is the midpoints of the bars. Since you specified
> Graph <- barplot(dat$Average) You can get the midpoints from the Graph object. So to put the number on top of each bar you might use something like: > text(Graph, dat$Average, dat$Average) -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mohsen Jafarikia Sent: Monday, July 27, 2009 10:02 AM To: r-h...@stat.math.ethz.ch Subject: [R] numbers on barplot Hello all, I have this simple barplot code: ifn <- "id.dat" dat <- read.table(ifn) ofn <- "id.png" bitmap(ofn, type = "png256", width = 30, height = 30, pointsize = 30, bg = "white",res=50) par(mar=c(5, 5, 3, 2),lwd=5) par(cex.main=1.6,cex.lab=1.6,cex.axis=1.6) names(dat)<-c("NumberOfPeople","Average") Graph<-barplot(dat$Average) dev.off() and here is the data (id.dat): 15 0.08 6 0.09 7 0.37 I want to write down the ""NumberOfPeople" on top of each of the bars. Can anybody help me on this? Thanks, Mohsen [[alternative HTML version deleted]] ______________________________________________ R-help@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. =================================== P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S. News & World Report (2008). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} ______________________________________________ R-help@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.