[R] How to scale a histogram

Rolf Turner r.turner at auckland.ac.nz
Thu Dec 10 20:27:04 CET 2009


On 11/12/2009, at 4:01 AM, terry johnson wrote:

> If I want to scale a histogram ie multiply by a constant how would  
> I do
> this? Thanks

This question is pretty vague.  Please read the posting guide.

If you want to rescale the y-axis you could do something like:

 > set.seed(333) # Only half evil.
 > x <- rnorm(300)
 > h <- hist(x,plot=FALSE)
 > h$counts <- h$counts*42
 > plot(h,ylab="Rescaled counts")

If you want to rescale the x-axis, see the posting by Stephan Devriese.

	cheers,

		Rolf Turner


######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list