Skip to content

Instantly share code, notes, and snippets.

@hawleylin
Created March 25, 2020 16:20
Show Gist options
  • Save hawleylin/fe2f194f76dec1ad0031c8edec78b5fc to your computer and use it in GitHub Desktop.
Save hawleylin/fe2f194f76dec1ad0031c8edec78b5fc to your computer and use it in GitHub Desktop.
Make another interesting plot using this data.
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"description": "Assignment 3rd graph",
"width": 400,
"height": 400,
"padding": 5,
"data": {
"url": "https://raw.githubusercontent.com/vda-lab/vda-lab.github.io/master/assets/station_366.json"
},
"transform": [
{"calculate": "2011-datum.birthyear", "as": "age"},
{"filter":
{
"and": [{"field": "gender", "gt": 0}, {"field": "age", "lt": 80}]
}
}
],
"mark": {"type": "bar", "cornerRadiusTopLeft": 3, "cornerRadiusTopRight": 3},
"encoding": {
"x": {
"field": "age",
"bin": {"maxbins": 40},
"type": "quantitative"
},
"y": {
"field": "tripduration",
"aggregate": "count",
"type": "quantitative"
},
"color": {"field": "gender", "type": "nominal"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment