-
Notifications
You must be signed in to change notification settings - Fork 608
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
resolve within a facet leads to Unrecognized scale name #4373
Comments
This is a bug. Thanks for the report! |
Ahh, so the problem is that the scales are defined inside each cell (which makes sense since they should be independent) but the header is defined outside and references a wrong scale. |
Hmm, I wonder why Vega-Lite does not automatically also make the axes independent. |
Something is wrong with layers inside facet. With just facet, it works. {
"data": {
"url": "https://vega.github.io/vega-datasets/data/seattle-weather.csv"
},
"facet": {
"column": {
"field": "weather",
"type": "nominal"
}
},
"spec": {
"encoding": {
"x": {
"field": "date",
"timeUnit": "month",
"type": "temporal"
},
"y": {
"aggregate": "mean",
"field": "precipitation",
"type": "quantitative"
}
},
"mark": {
"color": "steelblue",
"type": "line"
}
},
"resolve": {
"scale": {
"y": "independent"
}
}
} |
As soon as we use a layer, it breaks: {
"data": {
"url": "https://vega.github.io/vega-datasets/data/seattle-weather.csv"
},
"facet": {
"column": {
"field": "weather",
"type": "nominal"
}
},
"spec": {
"layer": [{
"encoding": {
"x": {
"field": "date",
"timeUnit": "month",
"type": "temporal"
},
"y": {
"aggregate": "mean",
"field": "precipitation",
"type": "quantitative"
}
},
"mark": {
"color": "steelblue",
"type": "line"
}
}],
"resolve": {
"scale": {
"y": "independent"
}
}
}
} |
Ahh, what you want is this (move the resolve one up). {
"data": {
"url": "https://vega.github.io/vega-datasets/data/seattle-weather.csv"
},
"facet": {
"column": {
"field": "weather",
"type": "nominal"
}
},
"spec": {
"layer": [
{
"encoding": {
"x": {
"field": "date",
"timeUnit": "month",
"type": "temporal"
},
"y": {
"aggregate": "mean",
"field": "temp_max",
"type": "quantitative"
}
},
"mark": {
"color": "salmon",
"type": "line"
}
},
{
"encoding": {
"x": {
"field": "date",
"timeUnit": "month",
"type": "temporal"
},
"y": {
"aggregate": "mean",
"field": "precipitation",
"type": "quantitative"
}
},
"mark": {
"color": "steelblue",
"type": "line"
}
}
]
},
"resolve": {
"scale": {
"y": "independent"
}
}
} @jakevdp Your original spec would result in dual-axis charts for each facet. I don't think we should crash but at least we know what the right spec is. |
As I read it, that was the intent of the person asking the SO question. |
I see. Maybe it's not too hard to support it. It just wasn't one of the things I had tested when I wrote the resolve code. |
Perhaps an hconcat + filter would be a good workaround? I haven't checked if that works. |
Yeah, the concat workaround is fine here: vega editor |
May I know if this decision has remain unchanged? Will faceted dual axis charts be supported in the future? |
Yes, after the 4.0 release, I plan to spend some time on the dataflow code to fix issues like this. If anyone wants to help, please do. |
The following spec leads to an error (editor link)
What I expect is that it would behave just like the following spec, except with independent y axis within each facet:
(editor link)
Related to https://stackoverflow.com/questions/53787262/vega-lite-independent-scale-with-multiple-layers-and-facet
The text was updated successfully, but these errors were encountered: