[Rd] hist(..., log="y")

Ott Toomet otoomet @end|ng |rom gm@||@com
Sun Aug 6 08:49:38 CEST 2023


Sorry if this topic has been discussed earlier.

Currently, hist(..., log="y") fails with

> hist(rexp(1000, 1), log="y")
Warning messages:
1: In plot.window(xlim, ylim, "", ...) :
  nonfinite axis=2 limits [GScale(-inf,2.59218,..); log=TRUE] -- corrected
now
2: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
  "log" is not a graphical parameter
3: In axis(1, ...) : "log" is not a graphical parameter
4: In axis(2, at = yt, ...) : "log" is not a graphical parameter

The same applies for log="x"

> hist(rexp(1000, 1), log="x")
Warning messages:
1: In plot.window(xlim, ylim, "", ...) :
  nonfinite axis=1 limits [GScale(-inf,0.954243,..); log=TRUE] -- corrected
now
2: In title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
  "log" is not a graphical parameter
3: In axis(1, ...) : "log" is not a graphical parameter
4: In axis(2, at = yt, ...) : "log" is not a graphical parameter

This applies for the current svn version of R, and also a few recent
published versions.  This is unfortunate for two reasons:

* the error message is not quite correct--"log" is a graphical parameter,
but "hist" does not support it.
* for various kinds of data it is worthwhile to make histograms in log
scale.  "hist" is a very nice and convenient function and support for log
scale would be handy here.

I also played a little with the code, and it seems to be very easy to
implement.  I am happy to make a  patch if the team thinks it is worth
pursuing.

Cheers,
Ott

	[[alternative HTML version deleted]]



More information about the R-devel mailing list