Skip to content

Instantly share code, notes, and snippets.

@mcnuttandrew
Created February 12, 2024 20:58
Show Gist options
  • Save mcnuttandrew/dfa26bfc1ecfae8c9267f1611b9c4279 to your computer and use it in GitHub Desktop.
Save mcnuttandrew/dfa26bfc1ecfae8c9267f1611b9c4279 to your computer and use it in GitHub Desktop.
Vega-lite Arrow Direction
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"config": {"view": {"stroke": ""}},
"width": 800,
"height": 200,
"data": {
"values": [
{"direction": "right", "col": 3},
{"direction": "right", "col": 2},
{"direction": "right", "col": 1},
{"direction": "up", "col": 2},
{"direction": "up", "col": 1},
{"direction": "left", "col": 10},
{"direction": "left", "col": 9},
{"direction": "left", "col": 8},
{"direction": "left", "col": 7},
{"direction": "left", "col": 6},
{"direction": "left", "col": 5},
{"direction": "left", "col": 4},
{"direction": "left", "col": 3},
{"direction": "left", "col": 2},
{"direction": "left", "col": 1},
{"direction": "right", "col": 9},
{"direction": "right", "col": 8},
{"direction": "right", "col": 7},
{"direction": "right", "col": 6},
{"direction": "right", "col": 5},
{"direction": "right", "col": 4},
{"direction": "right", "col": 3},
{"direction": "right", "col": 2},
{"direction": "right", "col": 1},
{"direction": "up", "col": 6},
{"direction": "up", "col": 5},
{"direction": "up", "col": 4},
{"direction": "up", "col": 3},
{"direction": "up", "col": 2},
{"direction": "up", "col": 1},
{"direction": "left", "col": 7},
{"direction": "left", "col": 6},
{"direction": "left", "col": 5},
{"direction": "left", "col": 4},
{"direction": "left", "col": 3},
{"direction": "left", "col": 2},
{"direction": "left", "col": 1},
{"direction": "down", "col": 0}
]
},
"mark": {"type": "point", "filled": true},
"encoding": {
"x": {"field": "col", "type": "ordinal", "axis": null},
"y": {"field": "direction", "type": "ordinal", "axis": null},
"shape": {
"field": "direction",
"type": "nominal",
"scale": {
"domain": ["down", "right", "up", "left"],
"range": [
"M2.51755 2.99998L2.51755 0.70874L0.949572 0.70874L0.949572 2.99998H-4.86374e-05L1.70872 4.70874L3.41748 2.99998H2.51755Z",
"M2.79124 0.899931H0.5V2.46791H2.79124V3.41753L4.5 1.70876L2.79124 0V0.899931Z",
"M1.19119 2.41751V4.70874H2.75917V2.41751H3.70879L2.00002 0.70874L0.29126 2.41751H1.19119Z",
"M2.41751 2.51755L4.70874 2.51755V0.949572L2.41751 0.949572V-4.86374e-05L0.70874 1.70872L2.41751 3.41748V2.51755Z"
]
},
"legend": null
},
"color": {
"field": "direction",
"type": "nominal",
"legend": null,
"scale": {
"domain": ["down", "right", "up", "left"],
"range": [
"rgb(162,160,152)",
"rgb(194,81,64)",
"rgb(93,93,93)",
"rgb(91,131,149)"
]
}
},
"opacity": {"value": 1},
"size": {"value": 200}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment