plottable icon indicating copy to clipboard operation
plottable copied to clipboard

Implement Plot.Histogram

Open rcchen opened this issue 11 years ago • 8 comments

Requires users to define the size of the buckets for the histogram relative to the axes. Start position for the buckets can be inferred from the scale. Should work with most scales, though primary targets will be CategoryScale (formerly OrdinalScale) and TimeScale to start.

This implementation will not handle auto-bucketing. This is because we don't want to be guessing at what users actually want in terms of buckets. For example, with TimeAxis, it is hard to judge whether a user wants to operate at the day, month, or even year level of granularity. Users are expected to bucket their data prior to adding the data to Plottable.

rcchen avatar Feb 28 '15 23:02 rcchen

Was implemented as a consequence of #1711

rcchen avatar Mar 16 '15 20:03 rcchen

How is Plot.Histogram implemented?

bluong avatar Mar 16 '15 20:03 bluong

With a GridPlot. On the x-axis, use x and x2. On the y-Axis, use y = 0 and y2 = value. I suppose the latter could be more explicit...if you feel this warrants a separate plot feel free to reopen.

rcchen avatar Mar 16 '15 20:03 rcchen

I think this might warrant further discussion mainly to get the semantics correct and to make usage not confusing. Note this as a workaround though for users that want immediate histogram behavior.

bluong avatar Mar 16 '15 20:03 bluong

@rcchen How is this different from a bar plot where users specify

plot.x(function(d) { return Math.floor(d.x / bucket_size) * bucket_size }, xScale)

aicioara avatar Jul 08 '15 20:07 aicioara

You could do that; it would also have to bucket the yValues of all the bars together (or toss out bars except for the first bar in the range), but there's also an issue of labels on the axis. Histograms are best thought of as having category scales where the categories represent ranges.

rcchen avatar Jul 08 '15 21:07 rcchen

So we still want this idea in or we can close it? I believe you can do that with bar plot and category scales as you suggested, so a new type of plot is not really needed.

aicioara avatar Jul 08 '15 21:07 aicioara

Doing it with Plots.Bar and Scales.Category is a hack, not an actual solution. Histograms should be spanning Scales.Linear or other Quantitative scales.

rcchen avatar Jul 08 '15 22:07 rcchen