[R] Log-scale in histogramm

Michael Toews mwtoews at sfu.ca
Sat Oct 14 20:19:20 CEST 2006


Log y-axis on histograms are conceptually wrong, but aren't a bad idea 
either. It is conceptually safer to show this using "density". Consider 
an exponential distribution, which could look better with a log y-axis:

x <- rexp(10000,.1)
xd <- density(x,from=0)
par(mfrow=c(2,1))
plot(xd)
plot(xd,log="y",ylab="Log Density")

Just use caution in the interpretation. The large dropping/osculating 
features on the right-hand side of the log plot are from sparse 
data-points, and this can be smoothed out by adjusting 'bw' to get a 
"theoretical" interpretation of the true distribution.
+mt



More information about the R-help mailing list