Hi everyone I am trying to add a percent sign to my labels in a hist() plot. "labels TRUE" gives me the values, but I don't know how to add the percent sign. I would prefer to annote the plot after drawing it, e.g. using text(), but don't know how to address the positions in a standard histogram. A lattice approach would work too. Best regards, LY -- View this message in context: http://www.nabble.com/How-to-change-labels-in-a-histogram-tp18333955p18333955.html Sent from the R help mailing list archive at Nabble.com.
> I am trying to add a percent sign to my labels in a hist() plot. "labels > TRUE" gives me the values, but I don't know how to add the percent sign. I > would prefer to annote the plot after drawing it, e.g. using text()This is probably a good starting point: x <- rnorm(100) h <- hist(x) text(h$mids, h$counts+0.5, paste(format(h$counts/sum(h$counts) * 100, digits=2), "%") ) cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://mips.gsf.de/staff/pagel
>>> Lord Yo <nabble at sporez.com> 07/08/08 9:00 AM >>> >I am trying to add a percent sign to my labels in a hist() plot.?hist says "labels: logical or character. " This should be a clue; labels could be a character vector. Try x<-rlnorm(128, 1) h<-hist(x, plot=F) plot(h, labels=paste(round(100*h$counts/sum(h$counts),1),"%",sep="")) Steve E ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}