Repository navigation
Replies: 1 comment
|
Neither, in practice. I compiled a chart with What works is aggregating as a transform and imputing the named result: alt.Chart(df).transform_aggregate(
total="sum(value)", groupby=["date", "g"]
).mark_line(point=True).encode(
x="date:T", y=alt.Y("total:Q").impute(value=0), color="g:N"
)For missing dates there's a second catch: impute only fills key values that appear somewhere else in the data, for example in another color group. In a single series, a date with no rows is never added. I tested this by rendering small one-group and two-group examples through vl-convert and counting the drawn points and line segments. |
Uh oh!
There was an error while loading. Please reload this page.
Hi, I recently came across an issue where in plotting time series values for missing dates where not being plotted but a line was was being drawn between them. In the absence of
point=Truethe dots weren't being shown which made it difficult to perceive this at first. This resulted in the plot distorting the data, showing missing values that should be 0 as the interpolation of its neighbouring values.I then researched altair docs for how to handle these cases and I came across
.imputewhich is great. My question is, how does.imputehandle transformations in the encode stage?x=alt.X('sum(value)').impute(value = 0), does it impute thevaluecolumn pre-aggregation or the transformationsum(value)?find an interactive minimal reprex in this link: https://marimo.io/p/@lucharo/notebook-3cyj2l
All reactions