为什么使用垂直方向为我的分层线图不做任何事情?
如果我将水平
更改为垂直
在这里,轴不切换:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"layer": [{
"data": {"values": [
{"x": 0.5, "y": 0},
{"x": 1, "y": 1},
{"x": 2, "y": 2}]},
"mark": {"type": "line", "orient": "horizontal"},
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"color": {"datum": "a"}}
}, {
"data": {"values": [
{"x": 1, "y": 0},
{"x": 2, "y": 1},
{"x": 2.5, "y": 2}]},
"mark": {"type": "line", "orient": "horizontal"},
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"color": {"datum": "b"}}
}
]
}
为什么?如何使X轴和Y轴切换位置?
If I change horizontal
to vertical
here, the axes don't switch:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"layer": [{
"data": {"values": [
{"x": 0.5, "y": 0},
{"x": 1, "y": 1},
{"x": 2, "y": 2}]},
"mark": {"type": "line", "orient": "horizontal"},
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"color": {"datum": "a"}}
}, {
"data": {"values": [
{"x": 1, "y": 0},
{"x": 2, "y": 1},
{"x": 2.5, "y": 2}]},
"mark": {"type": "line", "orient": "horizontal"},
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"color": {"datum": "b"}}
}
]
}
Why is that? How to get the x-axis and y-axis to switch places?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
还必须切换“编码”的“ x”和“ y”属性:
It's also necessary to switch the "x" and "y" properties of "encoding":