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

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Sun Aug 6 18:00:51 CEST 2023


hist() is designed so that the total area sums to 1. You should build you desired behavior using a barchart. 

— 
David


Sent from my iPhone

> On Aug 5, 2023, at 11:50 PM, Ott Toomet <otoomet using gmail.com> wrote:
> 
> 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]]
> 
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list