-
Notifications
You must be signed in to change notification settings - Fork 626
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
Binned x/y encoding ignores scale domain parameter #3575
Comments
@yhoonkim I remember you work on this. Can you remember why setting bin scale's domain is prevented? https://github.com/vega/vega-lite/blob/master/src/compile/scale/domain.ts#L177 (It should be relatively easy to fix, but wanna understand if fixing doesn't cause other bad effects / regression.) |
I guess we prefer to control the scale by
So we ignored -- The above Jeff's spec generates
However, |
@yhoonkim can you help fix this then? |
@kanitw I'll try! To solve this, I need to hear your thoughts about the below specs and their outcomes. Could you tell me if they look OK?
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"values": [0.1, 0.6, 2.3]},
"mark": "bar",
"encoding": {
"x": {
"field": "data",
"type": "quantitative",
"bin": {"extent": [0, 10], "step": 2},
"scale": {"domain": [-1, 3]}
},
"y": {
"aggregate": "count",
"type": "quantitative",
"scale": {"domain": [0, 2]}
}
}
}
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"values": [0.1, 0.6, 2.3]},
"mark": "bar",
"encoding": {
"x": {
"field": "data",
"type": "quantitative",
"bin": {"extent": [0, 10], "step": 2},
"scale": {"domain": [-10, 20]}
},
"y": {
"aggregate": "count",
"type": "quantitative",
"scale": {"domain": [0, 2]}
}
}
} (In my opinion, It looks OK. If users want to draw ticks, they should specify |
The problem is that axis's
I think it's better if the start and stop are replaced with domain min and domain max. but I'm not sure how to do that in Vega expression and maybe it's okay to just drop
We should make scale domain depends on explicitly set Basically,
should have the domain = (I guess this isn't too magical and should be a reasonable default?) |
Fix #3575 - If `scale.domain` is specified, use `scale.domain` despite `bin`. - If `scale.domain` is specified, axis' ticks are ranged over `scale.domain` instead of the signal of the `bin.extent`. - If `bin.extent` is specified, the scale domain is `bin.extent` by default.
When using a binned spatial encoding, custom scale domain settings seem to be ignored. The generated Vega pulls the scale domain from the data, not the provided custom domain.
Here is an example spec:
I expect the x-axis domain to be
[0, 10]
, but instead it is[0, 2.5]
.The text was updated successfully, but these errors were encountered: