Skip to content

Instantly share code, notes, and snippets.

@hawleylin
Created March 25, 2020 16:18
Show Gist options
  • Save hawleylin/d86003f8f4efe4f7ec98d91c5568704c to your computer and use it in GitHub Desktop.
Save hawleylin/d86003f8f4efe4f7ec98d91c5568704c to your computer and use it in GitHub Desktop.
Make a plot with the relative positions of the start stations vis-a-vis the end station, when that end station is 336. Show the end station itself as well. Your plot could look like this: (see tutorial)
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "Assignment 2nd graph",
"width": 500,
"height": 500,
"padding": 5,
"data": {
"url": "https://raw.githubusercontent.com/vda-lab/vda-lab.github.io/master/assets/station_366.json"
},
"transform": [
{"filter": {"field": "endstation_id", "equal": 336}}
],
"layer":[
{
"mark": {"type": "circle", "opacity": 0.3},
"encoding": {
"x": {
"field": "startstation_longitude",
"scale": {"domain": [-74.06,-73.90]},
"type": "quantitative"
},
"y": {
"field": "startstation_latitude",
"scale": {"domain": [40.82,40.64]},
"type": "quantitative"
}
}
},
{
"mark": "circle",
"encoding": {
"x": {
"field": "endstation_longitude",
"scale": {"domain": [-74.06,-73.90]},
"type": "quantitative"
},
"y": {
"field": "endstation_latitude",
"scale": {"domain": [40.82,40.64]},
"type": "quantitative"
},
"color": {"value":"red"},
"size": {"value": 250},
"opacity":{"value":0.01}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment