【发布时间】:2013-12-30 04:02:34
【问题描述】:
我正在使用 Python 中的 Vincent 创建 StackedBar 可视化项。数据来自 pandas 数据框,每列代表一个百分比,每行总和为 100%
Vincent / Vega 试图提供帮助,并在 Y 轴上添加一个缓冲区,以便当我想达到 100 时它会在 110 (%) 时达到最大值。
我需要添加的属性是 Y 刻度语法中的“domainMax”,但在导入 Pandas 数据框后,我不知道如何使用 Vincent 的 PropertySet 或类似命令添加它。
这是手动添加 domainMax 的数据示例,任何人都可以建议如何在 Python 中执行此操作
"scales": [
{
"domain": {
"data": "table",
"field": "data.idx"
},
"name": "x",
"range": "width",
"type": "ordinal"
},
{
"domain": {
"data": "stats",
"field": "sum"
},
"name": "y",
"nice": true,
"range": "height",
"type": "linear",
"domainMax": 100
}
[...]
【问题讨论】:
标签: python pandas vega vincent