Skip to content

Instantly share code, notes, and snippets.

@n-dragon
Created January 25, 2021 21:05
Show Gist options
  • Save n-dragon/6730cb82ef4af02135468f1d92e2463a to your computer and use it in GitHub Desktop.
Save n-dragon/6730cb82ef4af02135468f1d92e2463a to your computer and use it in GitHub Desktop.
Vega spec from Mon Jan 25 2021
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 900,
"height": 560,
"padding": {"top": 0, "left": 0, "right": 0, "bottom": 0},
"signals": [],
"data": [ {
"name": "airports",
"url": "data/airports.csv",
"format": {"type": "csv", "parse": "auto"},
"transform": [
{
"type": "geopoint",
"projection": "projection",
"fields": ["longitude", "latitude"]
},
{
"type": "filter",
"expr": "datum.x != null && datum.y != null"
}
]
},{
"name": "states",
"url": "data/us-10m.json",
"format": {"type": "topojson", "feature": "states"},
"transform": [
{
"type": "geopath",
"projection": "projection"
}
]
}],
"scales": [],
"projections": [ {
"description":"project map x y to longitude latitude, different type of projection",
"name": "projection",
"type": "albersusa",
"scale": 1200,
"translate": [{"signal": "width / 2"}, {"signal": "height / 2"}]
}],
"marks": [
{
"type": "path",
"from": {"data": "states"},
"encode": {
"enter": {
"fill": {"value": "#dedede"},
"stroke": {"value": "white"}
},
"update": {
"path": {"field": "path"}
}
}
},
{
"type": "symbol",
"from": {"data": "airports"},
"encode": {
"enter": {
"size": {"value": 16},
"fill": {"value": "steelblue"},
"fillOpacity": {"value": 0.8},
"stroke": {"value": "white"},
"strokeWidth": {"value": 1.5}
},
"update": {
"x": {"field": "x"},
"y": {"field": "y"}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment