Last active
October 11, 2019 22:49
-
-
Save harishtella/8179a6b5bf2840a7d8a236f667456b83 to your computer and use it in GitHub Desktop.
Vega-lite: comparing box-plot and strip-plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"height": {"step": 30}, | |
"width": 300, | |
"description": "Shows the relationship between horsepower and the numbver of cylinders using tick marks.", | |
"data": {"url": "data/cars.json"}, | |
"mark": { | |
"type": "boxplot", | |
"extent": "min-max" | |
}, | |
"encoding": { | |
"x": {"field": "Horsepower", "type": "quantitative", | |
"axis": {"grid": true}}, | |
"y": {"field": "Cylinders", "type": "ordinal"}, | |
"color": {"aggregate": "count", | |
"type": "quantitative"} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"data": { | |
"url": "data/cars.json" | |
}, | |
"vconcat": [ | |
{ | |
"mark": { | |
"type": "boxplot", | |
"extent": "min-max" | |
}, | |
"encoding": { | |
"x": { | |
"field": "Horsepower", | |
"type": "quantitative", | |
"axis": { | |
"grid": true | |
} | |
}, | |
"y": { | |
"field": "Cylinders", | |
"type": "ordinal" | |
}, | |
"color": { | |
"aggregate": "count", | |
"type": "quantitative" | |
} | |
} | |
}, | |
{ | |
"layer": [ | |
{ | |
"mark": { | |
"type": "tick", | |
"tooltip": true | |
}, | |
"encoding": { | |
"x": { | |
"field": "Horsepower", | |
"type": "quantitative", | |
"axis": { | |
"grid": false | |
} | |
}, | |
"y": { | |
"field": "Cylinders", | |
"type": "ordinal" | |
} | |
} | |
}, | |
{ | |
"mark": { | |
"type": "rule" | |
}, | |
"encoding": { | |
"x": { | |
"field": "Horsepower", | |
"aggregate": "min", | |
"type": "quantitative", | |
"axis": { | |
"grid": false | |
} | |
}, | |
"x2": { | |
"field": "Horsepower", | |
"aggregate": "max" | |
}, | |
"y": { | |
"field": "Cylinders", | |
"type": "ordinal" | |
}, | |
"strokeWidth": { | |
"value": 0.3 | |
} | |
} | |
} | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"data": {"url": "data/cars.json"}, | |
"vconcat": [ | |
{ | |
"mark": { | |
"type": "boxplot", | |
"extent": "min-max" | |
}, | |
"encoding": { | |
"x": {"field": "Horsepower", "type": "quantitative", | |
"axis": {"grid": true}}, | |
"y": {"field": "Cylinders", "type": "ordinal"}, | |
"color": {"aggregate": "count", | |
"type": "quantitative"} | |
} | |
}, | |
{ | |
"mark": { | |
"type": "tick", | |
"tooltip": true | |
}, | |
"encoding": { | |
"x": {"field": "Horsepower", "type": "quantitative", | |
"axis": {"grid": false}}, | |
"y": {"field": "Cylinders", "type": "ordinal"} | |
} | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"description": "Shows the relationship between horsepower and the numbver of cylinders using tick marks.", | |
"data": {"url": "data/cars.json"}, | |
"spacing": 30, | |
"bounds": "flush", | |
"hconcat": [ | |
{ | |
"mark": { | |
"type": "tick", | |
"tooltip": true | |
}, | |
"encoding": { | |
"x": {"field": "Horsepower", "type": "quantitative", | |
"axis": {"grid": false}}, | |
"y": {"field": "Cylinders", "type": "ordinal"} | |
} | |
}, | |
{ | |
"mark": { | |
"type": "bar", | |
"tooltip": true | |
}, | |
"width": 50, | |
"encoding": { | |
"y": { | |
"field": "Cylinders", | |
"type": "ordinal", | |
"axis": null | |
}, | |
"x": { | |
"aggregate": "count", | |
"type": "quantitative", | |
"title": "count" | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
"height": {"step": 30}, | |
"width": 300, | |
"description": "Shows the relationship between horsepower and the numbver of cylinders using tick marks.", | |
"data": {"url": "data/cars.json"}, | |
"mark": { | |
"type": "tick", | |
"tooltip": true | |
}, | |
"encoding": { | |
"x": {"field": "Horsepower", "type": "quantitative", | |
"axis": {"grid": false}}, | |
"y": {"field": "Cylinders", "type": "ordinal"} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment