Skip to content
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

Should we revise the rule for including zero in positional scale domains? #7154

Closed
domoritz opened this issue Jan 5, 2021 · 5 comments
Closed
Assignees
Labels
RFC / Discussion 💬 For discussing proposed changes
Milestone

Comments

@domoritz
Copy link
Member

domoritz commented Jan 5, 2021

Vega-Lite always includes zero in the positional scale domains. Maybe we should only do it for marks that have an area (bar, area) but not lines/points/etc.

See https://github.com/vega/vega-lite/blob/master/src/compile/scale/properties.ts#L397

@domoritz domoritz added the RFC / Discussion 💬 For discussing proposed changes label Jan 5, 2021
@domoritz domoritz added this to the 5.0 milestone Jan 5, 2021
@domoritz domoritz self-assigned this Jan 5, 2021
@jwoLondon
Copy link
Contributor

No sure I see the logic in the mark determining the scaling. If anything, zero origin should be a property of measurement type (nominal, ordinal, interval -> not zero; ratio -> zero). e.g. an area chart showing temperature would probably not have a zero origin, but a line chart of counts probably would.

But given this is more often an issue of context I think it better to leave it for all marks by default for backwards compatiblity.

@domoritz
Copy link
Member Author

domoritz commented Jan 5, 2021

One could argue that when we have e.g. line marks, we don't need to include 0 in the y scale domain since the line encodes with position, not length. I agree that context matters more and users should always be able to change the default but I am wondering what a good default is.

The reason why I bring this up is that Datawrapper changes whether to include 0 based on the mark type: https://twitter.com/wisevis/status/1346522488575033344/.

Example: bottom two is what we do right now, first is what we could be doing by default.

Open the Chart in the Vega Editor

image

@jwoLondon
Copy link
Contributor

If the logic is that in area charts we are integrating the shaded area, I'd suggest we mentally integrate the area under a line too.

I think with a non-zero default for quantitatively scaled line charts, there is a greater risk of people creating poor charts by accepting a non-zero default than accepting a default zero origin. An advantage of the zero default is that if the scaling ends up being very poor (e.g. a variation between 99-100 with a zero origin), it is immediately visually obvious, whereas, like your top example, a potentially misleading non-zero origin is more subtly problematic and so less likely to be changed.

@domoritz
Copy link
Member Author

domoritz commented Jan 5, 2021

I like your point about it being obvious that zero should not be included and including zero being safer to not be misleading.

Being safer by default is better than being a less effective (including zero reduces the distance used to encode data).

@domoritz domoritz closed this as completed Jan 5, 2021
@kanitw kanitw reopened this Jul 26, 2022
@kanitw kanitw modified the milestones: 5.0, 2022 Aug Polishes Jul 26, 2022
@kanitw
Copy link
Member

kanitw commented Aug 9, 2022

In #8324, we're discussing about making this configurable.

@kanitw kanitw closed this as completed Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC / Discussion 💬 For discussing proposed changes
Projects
None yet
Development

No branches or pull requests

3 participants