On 05/15/2010 12:19 AM, Federico Calboli wrote:
Hi All,

I am in the annoying position of having to present some data to someone who 
seems to be somewhat less than numerate. I need to label the y-axes of a 
multhist with the y-axis labeled not as counts but as percentage of a 
population. Plotting the standard histogram is in a way fine, all I need is to:

-- have a left-handside y-axis labels for pop 1 and a right-handside y-axis 
labels for pop2
-- replace the counts in each axis with population percentages (easy to 
calculate, but how to stick them there?)

Hi Federico,
I may not have quite the right idea of what you want to do, but take a look at the last example for the barp function in the plotrix package. You seem to want the two ordinates because the positions of the percentages might be different? They won't be with barp used in that way, but you can add room for a right ordinate:

par(mar=c(5,4,4,4))

and add axes with custom labels (assume that the total count is 50):

axis(2,at=c(5,10,15,20),labels=c("10%","20%","30%","40%"))

or you can use the height.at and height.lab arguments in barp.

Jim

______________________________________________
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.

Reply via email to