HistogramList
and Histogram
are closely related:
data = RandomVariate[NormalDistribution[], 200];
bSpec = {1};
{
BarChart[Last[HistogramList[data, bSpec]]],
Histogram[data, bSpec]
}
DateHistogram
is more like a black box with respect to that:
dates = AbsoluteTime /@ RandomChoice[DateRange[{2010, 1, 1}, {2010, 5, 31}, "Day"], 200];
bSpec = "Month";
{
BarChart[Last[HistogramList[dates, bSpec]]],
DateHistogram[dates, bSpec]
}
One could do
Reap[DateHistogram[dates, "Month", (Sow[{##}]; #2) &]][[2, 1, 1]]
{{{3471292800, 3473971200}, {3473971200, 3476390400}, {3476390400,
3479068800}, {3479068800, 3481660800}, {3481660800, 3484339200}}, {29, 29, 42, 47, 53}}
BarChart @ Last @ %
And tweak it but it is not pretty/efficient.
Question
Is there a better way to get HistogramList
for dates based data? Compatible with DateHistogram
?
"Month"
is not a valid bin specification forHistogramList
so you are getting theAutomatic
setting. You would need to create a bin function that would give a date (maybeAbsoluteTime
) partition of the dates forHistogramList
. $\endgroup$