Created
April 26, 2022 02:34
-
-
Save Dulani/840bd8dd00e18c8b9f9e01a12e809898 to your computer and use it in GitHub Desktop.
Density histogram with a vertical rule and some other formatting
This file contains hidden or 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
/* | |
Density histogram with a vertical rule and some other formatting. | |
*/ | |
{ | |
"$schema": "https://vega.github.io/schema/vega-lite/v5.json", | |
"datasets": { | |
"linedata": [ | |
{"b": 5}, | |
{"b": 20}, | |
{"b": 20}, | |
{"b": 20}, | |
{"b": 40}, | |
{"b": 25}, | |
{"b": 20}, | |
{"b": 15}, | |
{"b": 100} | |
], | |
"ruledata": {"ownval": 25} | |
}, | |
"layer": [ | |
{ | |
"data": {"name": "linedata"}, | |
"width": 600, | |
"height": 500, | |
"transform": [{"density": "b", "bandwidth": 15}], | |
"mark": {"type": "area", "color": "#663399"}, | |
"encoding": { | |
"x": { | |
"field": "value", | |
"type": "quantitative", | |
"axis": { | |
"title": "Average Hours", | |
"ticks": 5, | |
"labelFontSize": 15, | |
"titleFontSize": 15, | |
"tickMinStep": 10 | |
} | |
}, | |
"y": {"field": "density", "type": "quantitative", "axis": false} | |
} | |
}, | |
{ | |
"data": {"name": "ruledata"}, | |
"mark": { | |
"type": "rule", | |
"strokeDash": [4, 4], | |
"size": 3, | |
"color": "black" | |
}, | |
"encoding": {"x": {"field": "ownval", "type": "quantitative"}} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment