-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto: can it be made to make a timeseries bar chart? #1800
Comments
Ok well at least it isn’t a regression. I was worried I’d made it worse, but no, it’s just the age-old ordinal interval problem; at 0.6.8, one commit before #1674, nothing shows at all:
|
Imagine that instead of value you have temperature. Would you expect that |
This also seems like a bug: Plot.auto(data, {x: "date", y: {value: "value", zero: true}, color: "type", mark: "bar"}).plot() I would expect this to produce the barY also. I think the real problem is that x is not ordinal (it’s dates)… and we’re hesitant to treat temporal data as ordinal because there could be gaps, and we can’t easily infer the interval. But perhaps it’s better to treat x as ordinal when you explicitly specify the bar mark, and certainly that should be better than showing nothing? |
Yes, I think so. Bar implies meaningful zero, which implies stackability. At least, I can’t think of a counterexample. (I.e., bars for temperature already feels wrong.) Sometimes people use bars because they don’t want a line’s interpolation between points, but if it’s not zeroful/additive it should probably be ticks.
Yeah, I wonder if this is the “get off your gg high horse and do what I obviously mean!” approach. I think #1790 addresses the main thing people would complain about… leaving the things they should be complaining about. But sometimes even the irregularity is a feature, e.g. if you wanna show stock market trading days without gaps for the weekends.
Hm! That’s a nice idea. Defaulting to sum would work nicely with autoSpec, showing in the UI and letting you opt out if needed. And it’d work well if (when) we add interval controls in the future. It’d be maddening if you just wanted one bar per data point, but that’s already an issue. If y were temperature, the sum reducer would be inappropriate; a non-additive reducer like mean or last would be better. But, again, I guess selecting “bar” already implies additivity? |
Currently, you can only make a bar chart with a temporal/quantitative independent axis if the dependent axis has a reducer specified (implicitly or explicitly). But you cannot make a temporal/quantitative bar chart with a simple value as the dependent encoding.
Plot.auto(olympians, {x: "date_of_birth"}).plot()
→ implicit count reducer on y, hence temporal bar chartPlot.auto(aapl, {x: "Date", y: "Volume", mark: "bar"}).plot()
→ surprising sparse matrix of cellsI know the bar-interval thing is a perennial headache lol, and others have raised it, but I’m feeling the pain right now and feeling motivated to come up with something!
E.g. for
Plot.auto(aapl, {x: "Date", y: "Volume"}).plot()
, we get a line, but it is inappropriate to interpolate values between successive days, so (hairline) bars would be better.I may have made this worse in #1674, which changed it to choose cell over rect if there's no reducer, which might've been too aggressive and prevents us from taking advantage of the rect's implicit y1 = 0. (But I'm sleepy and not sure it ever would've worked; can check later.)(Nope, see below.)Might be improved by #1790.
Example notebook:
The text was updated successfully, but these errors were encountered: