Thanks for looking at this. I did use geom_bar in fact, not geom_histogram. Using you example, I convinced myself a bit more than binwidth uses days in the case of a Date variable:
library(scales)
ggplot(DF, aes(x = date)) +
geom_bar(aes(weight = val),stat = "bin", binwidth = 60, fill = "orange") +scale_x_date(breaks = date_breaks("2 month"),labels = date_format("%b"))
This seems to be putting Jan in bin 1, Feb-Mar in bin 2, etc, though this is not clear from the x-scale.
Maybe I'd be better using something like the following to show the trend, rather than binning as a rough form of smoothing.
ggplot(DF, aes(x = date,y = val)) +
geom_point() + geom_path() + geom_smooth()
It's not what I wanted though and I'd really like to understand binwidth better. Maybe I'd have to look at the source code. None of the examples seem to use a Date or DateTime variable.
Hywel
@hywelm