Is it possible to create parallel coordinates in Vega-Lite? I'm looking for a simple yet powerful plotting library for JavaScript and support for parallel coordinates is a requirement.
Yes, you can create a parallel coordinates plot in Vega-Lite by combining a window transform and a fold transform. Here is an example with the Iris dataset (vega editor link):
{
"data": {
"url": "data/iris.json"
},
"transform": [
{"window": [{"op": "count", "as": "index"}]},
{"fold": ["petalLength", "petalWidth", "sepalLength", "sepalWidth"]}
],
"mark": "line",
"encoding": {
"color": {"type": "nominal", "field": "species"},
"detail": {"type": "nominal", "field": "index"},
"opacity": {"value": 0.3},
"x": {"type": "nominal", "field": "key"},
"y": {"type": "quantitative", "field": "value"}
},
"width": 600,
"height": 300
}
Notice we use a window transform to construct an index, followed by a fold transform to restructure the data for plotting.