-
Notifications
You must be signed in to change notification settings - Fork 187
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
Don’t ignore undefined values for ordinal dimensions, and make grouping and faceting consistent? #45
Comments
related #52 |
This needs to be fixed at the same time as #52. If we allow the group transform to return groups with null or undefined keys, the bar mark will currently refuse to display them: Whereas if the bar mark tests the scaled key to determine if the position is defined, then it will work as desired: Plot.plot({
y: {
grid: true
},
marks: [
Plot.groupBarY(data, {x: "sex"}),
Plot.ruleY([0])
]
}) If the null values are not desired, then the x-domain can be specified explicitly to not include null; however, the x-domain should also be made available as an option to the group transform so these values can be ignored. Otherwise the y-scale may have the wrong inferred domain. I’ll file a separate issue for a domain option for the group transform. |
Marks currently ignore data with undefined values. For example, BarX will ignore data whose y, x1 or x2 value is undefined.
plot/src/marks/bar.js
Line 44 in 9fc3a10
This is a handy feature for avoiding SVG errors. However, we’re not entirely inconsistent with grouping. I fixed the group1 transform to skip groups whose key is undefined,
plot/src/transforms/group.js
Line 7 in 9fc3a10
but I forgot to fix group2 at the same time. And we don’t apply this same technique to faceting, which is also inconsistent.
I’m now of the opinion that ignoring undefined data for ordinal dimensions — which includes grouping and faceting — is undesirable. Whereas there’s no consistent way to handle undefined data in a quantitative dimension, undefined values don’t have to be specially treated in ordinal dimensions. Furthermore, null and undefined are often used to represent an “other” or “unknown” category with grouping and faceting.
Therefore, I think we should changing the filtering logic and only filter undefined values for quantitative dimensions.
The text was updated successfully, but these errors were encountered: