[R] Log-scale in histogramm

Marc Schwartz MSchwartz at mn.rr.com
Fri Oct 13 16:28:27 CEST 2006


On Fri, 2006-10-13 at 13:33 +0200, David Graf wrote:
> Hello
> 
> My data looks ugly in a normal histogramm. How can I create a
> histogramm with a Y-axis in log-scale?
> 
> Thanks for your help!
> 
> David Graf

I'm not sure that you want to use a log scale here, but may be better
served by log transforming your data.

For example:

# Generate 100 random values from a log normal dist:
x <- rlnorm(100)


# Now do a histogram on x
hist(x, freq = FALSE)


# Now use log(x)
hist(log(x), freq = FALSE)


Does that help?

Marc Schwartz



More information about the R-help mailing list