From dw|n@em|u@ @end|ng |rom comc@@t@net  Sun Aug  6 18:00:51 2023
From: dw|n@em|u@ @end|ng |rom comc@@t@net (David Winsemius)
Date: Sun, 6 Aug 2023 09:00:51 -0700
Subject: [Rd] hist(..., log="y")
In-Reply-To: <CAMMJQ0b-AwgT-3U-4TQYwLA7+NPzj8E0Y2Q=xXk6KWOgCJqUjg@mail.gmail.com>
References: <CAMMJQ0b-AwgT-3U-4TQYwLA7+NPzj8E0Y2Q=xXk6KWOgCJqUjg@mail.gmail.com>
Message-ID: <A9103991-8E99-4B88-B595-8AAFEF94EE71@comcast.net>

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 at 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



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