From dw|n@em|u@ @end|ng |rom comc@@t@net  Sun Aug  6 18:33:00 2023
From: dw|n@em|u@ @end|ng |rom comc@@t@net (David Winsemius)
Date: Sun, 6 Aug 2023 09:33:00 -0700
Subject: [Rd] hist(..., log="y")
In-Reply-To: <A9103991-8E99-4B88-B595-8AAFEF94EE71@comcast.net>
References: <A9103991-8E99-4B88-B595-8AAFEF94EE71@comcast.net>
Message-ID: <E48C208C-3F31-41A4-8C05-9CAB2287CD94@comcast.net>

I guess my memory was off slightly. Densities are only plotted with freq=TRUE. Still there the ever present conundrum that 0 counts cannot be sensibly represented. 

Why not:
hist( log(x), ?) #? In situations where it might make sense. 


Sent from my iPhone

> On Aug 6, 2023, at 9:01 AM, David Winsemius <dwinsemius at comcast.net> wrote:
> 
> ?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