Skip to content

Instantly share code, notes, and snippets.

@alex-rind
Last active May 7, 2021 16:11
Show Gist options
  • Save alex-rind/9583760459b7cfe1fa17a74ec5ff212f to your computer and use it in GitHub Desktop.
Save alex-rind/9583760459b7cfe1fa17a74ec5ff212f to your computer and use it in GitHub Desktop.
scatter plot of blood pressure measurement with size and shape
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "scatter plot of blood pressure measurement with size and shape",
"width": 300,
"height": 180,
"data": {
"values": [
{"sex": "male", "BP systolic": 120, "BP diastolic": 80, "glucose": 190, "bmi": 28},
{"sex": "male", "BP systolic": 130, "BP diastolic": 90, "glucose": 95, "bmi": 24},
{"sex": "male", "BP systolic": 160, "BP diastolic": 110, "glucose": 150, "bmi": 38},
{"sex": "male", "BP systolic": 175, "BP diastolic": 105, "glucose": 140, "bmi": 34},
{"sex": "male", "BP systolic": 110, "BP diastolic": 72, "glucose": 90, "bmi": 24},
{"sex": "male", "BP systolic": 95, "BP diastolic": 68, "glucose": 90, "bmi": 24},
{"sex": "female", "BP systolic": 145, "BP diastolic": 90, "glucose": 80, "bmi": 28},
{"sex": "female", "BP systolic": 185, "BP diastolic": 120, "glucose": 140, "bmi": 40},
{"sex": "female", "BP systolic": 128, "BP diastolic": 85, "glucose": 140, "bmi": 31},
{"sex": "female", "BP systolic": 115, "BP diastolic": 70, "glucose": 120, "bmi": 16},
{"sex": "female", "BP systolic": 88, "BP diastolic": 62, "glucose": 90, "bmi": 16},
{"sex": "female", "BP systolic": 125, "BP diastolic": 80, "glucose": 130, "bmi": 22}
]
},
"layer": [
{
"mark": {
"type": "point",
"filled": true
},
"encoding": {
"x": {
"field": "BP systolic",
"type": "quantitative",
"scale": {"domain": [80,200]},
"axis": {"grid": false},
"title": "Blood Pressure Systolic"
},
"y": {
"field": "BP diastolic",
"type": "quantitative" ,
"scale": {"domain": [50,130]},
"axis": {"grid": false},
"title": "Blood Pressure Diastolic"
},
"size": {"field": "bmi", "type": "quantitative", "title": "BMI" },
"shape": {"field": "sex", "type": "nominal", "title": "Sex"}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment