vega-lite - 如何在 Vega Lite 中底部中间对齐图例?
问题描述
在 Vega Lite 中,我试图将我的图例与这张图表的中间对齐。我需要类似anchor
图例的参数,但我只能找到titleAnchor
.
"legend": {
"title": "Signed NDA",
"orient": "bottom",
"titleAnchor": "middle"
}
这就是我的传奇现在的样子。有人知道怎么做吗?
解决方案
没有将图例锚定在底部中心的选项,但您可以设置orient: "none"
和使用legendX
和legendY
属性将其准确定位到您想要的位置。例如(维加编辑器):
{
"data": {"url": "data/cars.json"},
"mark": "point",
"encoding": {
"x": {"field": "Horsepower", "type": "quantitative"},
"y": {"field": "Miles_per_Gallon", "type": "quantitative"},
"color": {
"field": "Origin",
"type": "nominal",
"legend": {
"orient": "none",
"direction": "horizontal",
"legendX": 120,
"legendY": 340,
"title": null
}
}
},
"height": 300,
"width": 400
}
推荐阅读
- c# - 条码扫描器在使用 DisplayActionSheet 后不会扫描
- r - 我在随机森林中获得的预测值比提供给它的新数据多吗?
- php - 在数组上使用 arsort 排序不起作用(对象)
- ios - 如何修复 iOS 13.1.2 AudioKit.renderToFile 异常:AUGraphParser::InitializeActiveNodesInInputChain(ThisGraph, *GetInputNode())):错误 -10868
- android - MPAndroidChart 将日期输入为 x 轴?
- macos - Catalina 中的 NSButton 没有选中状态
- python - Gsuite python客户端 - 将成员插入组
- javascript - 什么正则表达式模式将支持 Windows 文件夹创建?
- python - 如何在 Python 中使用 print 修复此语法错误?
- postgresql - 如何在 PostgreSQL 的表上运行函数插入或更新冲突