{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "A Wilkinson Dot Plot", "background": "white", "padding": 5, "height": 100, "style": "cell", "data": [ { "name": "source_0", "values": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "window", "params": [null], "as": ["id"], "ops": ["rank"], "fields": [null], "sort": {"field": [], "order": []}, "groupby": ["data"] } ] } ], "signals": [ {"name": "x_step", "value": 20}, { "name": "width", "update": "bandspace(domain('x').length, 1, 0.5) * x_step" } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["circle"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 1}, "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "circle"}, "description": { "signal": "\"data: \" + (isValid(datum[\"data\"]) ? datum[\"data\"] : \"\"+datum[\"data\"]) + \"; id: \" + (isValid(datum[\"id\"]) ? datum[\"id\"] : \"\"+datum[\"id\"])" }, "x": {"scale": "x", "field": "data"}, "y": {"scale": "y", "field": "id"}, "shape": {"value": "circle"} } } } ], "scales": [ { "name": "x", "type": "point", "domain": {"data": "data_0", "field": "data", "sort": true}, "range": {"step": {"signal": "x_step"}}, "padding": 0.5 }, { "name": "y", "type": "point", "domain": { "data": "data_0", "field": "id", "sort": {"order": "descending"} }, "range": [0, {"signal": "height"}], "padding": 0.5 } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": false, "title": "data", "labelAlign": "right", "labelAngle": 270, "labelBaseline": "middle", "zindex": 0 } ] }