Skip to content

Instantly share code, notes, and snippets.

@mjyc
Last active December 14, 2019 05:43
Show Gist options
  • Save mjyc/74a52fafd7d2b47e57076828b1461643 to your computer and use it in GitHub Desktop.
Save mjyc/74a52fafd7d2b47e57076828b1461643 to your computer and use it in GitHub Desktop.
Template Vega-Lite spec for boxplots displaying survey data
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {"values": [{"question":"Q1","rating":4,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":2,"iter":0},{"question":"Q1","rating":3,"iter":1},{"question":"Q2","rating":3,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":3,"iter":2},{"question":"Q2","rating":3,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":4,"iter":3},{"question":"Q3","rating":5,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":4,"iter":1},{"question":"Q2","rating":2,"iter":1},{"question":"Q3","rating":3,"iter":1},{"question":"Q1","rating":4,"iter":2},{"question":"Q2","rating":3,"iter":2},{"question":"Q3","rating":3,"iter":2},{"question":"Q1","rating":3,"iter":3},{"question":"Q2","rating":4,"iter":3},{"question":"Q3","rating":4,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":5,"iter":0},{"question":"Q1","rating":2,"iter":1},{"question":"Q2","rating":4,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":1,"iter":2},{"question":"Q2","rating":4,"iter":2},{"question":"Q3","rating":5,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":4,"iter":3},{"question":"Q3","rating":5,"iter":3},{"question":"Q1","rating":4,"iter":0},{"question":"Q2","rating":5,"iter":0},{"question":"Q3","rating":3,"iter":0},{"question":"Q1","rating":4,"iter":1},{"question":"Q2","rating":5,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":4,"iter":2},{"question":"Q2","rating":5,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":5,"iter":3},{"question":"Q1","rating":1,"iter":0},{"question":"Q2","rating":4,"iter":0},{"question":"Q3","rating":3,"iter":0},{"question":"Q1","rating":1,"iter":1},{"question":"Q2","rating":3,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":2,"iter":2},{"question":"Q2","rating":4,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":2,"iter":3},{"question":"Q2","rating":4,"iter":3},{"question":"Q3","rating":4,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":4,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":3,"iter":1},{"question":"Q2","rating":4,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":2,"iter":2},{"question":"Q2","rating":5,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":4,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":4,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":4,"iter":1},{"question":"Q2","rating":3,"iter":1},{"question":"Q3","rating":3,"iter":1},{"question":"Q1","rating":3,"iter":2},{"question":"Q2","rating":3,"iter":2},{"question":"Q3","rating":3,"iter":2},{"question":"Q1","rating":5,"iter":3},{"question":"Q2","rating":4,"iter":3},{"question":"Q3","rating":4,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":2,"iter":0},{"question":"Q1","rating":3,"iter":1},{"question":"Q2","rating":4,"iter":1},{"question":"Q3","rating":4,"iter":1},{"question":"Q1","rating":2,"iter":2},{"question":"Q2","rating":5,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":5,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":3,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":3,"iter":1},{"question":"Q2","rating":4,"iter":1},{"question":"Q3","rating":5,"iter":1},{"question":"Q1","rating":3,"iter":2},{"question":"Q2","rating":4,"iter":2},{"question":"Q3","rating":3,"iter":2},{"question":"Q1","rating":3,"iter":3},{"question":"Q2","rating":3,"iter":3},{"question":"Q3","rating":2,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":1,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":5,"iter":1},{"question":"Q2","rating":1,"iter":1},{"question":"Q3","rating":1,"iter":1},{"question":"Q1","rating":4,"iter":2},{"question":"Q2","rating":2,"iter":2},{"question":"Q3","rating":2,"iter":2},{"question":"Q1","rating":3,"iter":3},{"question":"Q2","rating":2,"iter":3},{"question":"Q3","rating":2,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":1,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":2,"iter":1},{"question":"Q2","rating":5,"iter":1},{"question":"Q3","rating":5,"iter":1},{"question":"Q1","rating":1,"iter":2},{"question":"Q2","rating":5,"iter":2},{"question":"Q3","rating":5,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":5,"iter":3},{"question":"Q1","rating":3,"iter":0},{"question":"Q2","rating":2,"iter":0},{"question":"Q3","rating":2,"iter":0},{"question":"Q1","rating":3,"iter":1},{"question":"Q2","rating":2,"iter":1},{"question":"Q3","rating":3,"iter":1},{"question":"Q1","rating":2,"iter":2},{"question":"Q2","rating":4,"iter":2},{"question":"Q3","rating":4,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":4,"iter":3},{"question":"Q1","rating":5,"iter":0},{"question":"Q2","rating":1,"iter":0},{"question":"Q3","rating":1,"iter":0},{"question":"Q1","rating":4,"iter":1},{"question":"Q2","rating":2,"iter":1},{"question":"Q3","rating":2,"iter":1},{"question":"Q1","rating":3,"iter":2},{"question":"Q2","rating":3,"iter":2},{"question":"Q3","rating":3,"iter":2},{"question":"Q1","rating":1,"iter":3},{"question":"Q2","rating":5,"iter":3},{"question":"Q3","rating":5,"iter":3}]},
"transform": [
{ "filter": { "field": "question", "equal": "Q1" } }
],
"mark": {
"type": "boxplot",
"extent": 1.5,
"median": { "color": "red" }
},
"encoding": {
"x": { "field": "iter", "type": "ordinal" },
"y": {
"field": "rating",
"type": "quantitative"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment