The following is a piece of documentation of the stat_bin(binwidth) argument:
Can be specified as a numeric value or as a function that calculates width from unscaled x. Here, "unscaled x" refers to the original x values in the data, before application of any scale transformation.
A quick test reveals that a binwidth function takes transformed values as input, not 'unscaled x' as the documentation suggests.
Note that min(diamonds$price) == 326, so evidently the values are log-transformed.
The following is a piece of documentation of the
stat_bin(binwidth)
argument:A quick test reveals that a
binwidth
function takes transformed values as input, not 'unscaled x' as the documentation suggests. Note thatmin(diamonds$price) == 326
, so evidently the values are log-transformed.Created on 2024-06-27 with reprex v2.1.0
I think the confusion stems from #2828. I propose this alternative: