Module

x/vega_lite/examples/compiled/circle_scale_threshold.vg.json

A concise grammar of interactive graphics, built on Vega.
Latest
File
{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 20, "style": "cell", "data": [ { "name": "source_0", "values": [ {"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43}, {"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53}, {"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52} ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"b\"]) && isFinite(+datum[\"b\"])" } ] } ], "signals": [ {"name": "y_step", "value": 20}, { "name": "height", "update": "bandspace(domain('y').length, 1, 0.5) * y_step" } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["circle"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"scale": "color", "field": "b"}, "ariaRoleDescription": {"value": "circle"}, "description": { "signal": "\"b: \" + (isValid(datum[\"b\"]) ? datum[\"b\"] : \"\"+datum[\"b\"])" }, "x": {"signal": "width", "mult": 0.5}, "y": {"scale": "y", "field": "b"}, "size": {"scale": "size", "field": "b"}, "shape": {"value": "circle"} } } } ], "scales": [ { "name": "y", "type": "point", "domain": {"data": "data_0", "field": "b"}, "range": {"step": {"signal": "y_step"}}, "padding": 0.5 }, { "name": "color", "type": "threshold", "domain": [30, 70], "range": {"scheme": "viridis"}, "interpolate": "hcl" }, { "name": "size", "type": "threshold", "domain": [30, 70], "range": [80, 200, 320] } ], "axes": [ { "scale": "y", "orient": "left", "grid": false, "domain": false, "ticks": false, "zindex": 0 } ], "legends": [ { "title": "Threshold", "fill": "color", "labelOverlap": "greedy", "symbolType": "circle", "encode": {"symbols": {"update": {"opacity": {"value": 0.7}}}}, "size": "size" } ]}