[R] Log scale in histograms

Jonathan Dushoff dushoff at eno.princeton.edu
Thu Sep 15 18:02:20 CEST 2005

> Can't find any information about this, but others must want to do it.

> In the example below, the second plot has the desired log scale,
> but the first does not.

> Any help appreciated.

Well, I had to solve this problem myself.  I hope that doesn't prove I
should have posted it.  I did spend a lot of time on it, both before and
after posting.

Here is a reasonable-looking histogram based on logged data:

hist(log10(area_Mh), 12, xlab="Area (Mh)", main="", axes=FALSE)
axis(1, labels=formatC(10^(axTicks(1)), digits=3))


More information about the R-help mailing list