是否可以在 Vega-Lite 上编写 Latex?
Is it possible to write Latex on Vega-Lite?
我想在 Latex 表达式中使用“文本”标记,并使用 Vega-Lite 绘制它。这可能吗?例如:
data = {x:[0,1,2,3],y:[0,1,2,3],t=["x^0","x^1","x^2","x^3"]}
{
"data":data
}],
"mark": "text",
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"text": {"field": "t", "type": "nominal"}
}
}
不,Vega-Lite 规范不支持 LaTeX 数学(相关功能请求是 here)。但是对于像您示例中的简单数学表达式,您通常可以使用 unicode 文本来表示它们:
{
"data":{
"values": [
{"x": 0, "t": "x⁰"},
{"x": 1, "t": "x¹"},
{"x": 2, "t": "x²"},
{"x": 3, "t": "x³"}
]
},
"mark": "text",
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "x", "type": "quantitative"},
"text": {"field": "t", "type": "nominal"}
}
}
我想在 Latex 表达式中使用“文本”标记,并使用 Vega-Lite 绘制它。这可能吗?例如:
data = {x:[0,1,2,3],y:[0,1,2,3],t=["x^0","x^1","x^2","x^3"]}
{
"data":data
}],
"mark": "text",
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "y", "type": "quantitative"},
"text": {"field": "t", "type": "nominal"}
}
}
不,Vega-Lite 规范不支持 LaTeX 数学(相关功能请求是 here)。但是对于像您示例中的简单数学表达式,您通常可以使用 unicode 文本来表示它们:
{
"data":{
"values": [
{"x": 0, "t": "x⁰"},
{"x": 1, "t": "x¹"},
{"x": 2, "t": "x²"},
{"x": 3, "t": "x³"}
]
},
"mark": "text",
"encoding": {
"x": {"field": "x", "type": "quantitative"},
"y": {"field": "x", "type": "quantitative"},
"text": {"field": "t", "type": "nominal"}
}
}