{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "A scatterplot showing body mass and flipper lengths of penguins.", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "url": "data/penguins.json", "format": {"type": "json"}, "transform": [ { "type": "filter", "expr": "isValid(datum[\"Flipper Length (mm)\"]) && isFinite(+datum[\"Flipper Length (mm)\"]) && isValid(datum[\"Body Mass (g)\"]) && isFinite(+datum[\"Body Mass (g)\"])" } ] } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["point"], "from": {"data": "source_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"scale": "color", "field": "Species"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Flipper Length (mm): \" + (format(datum[\"Flipper Length (mm)\"], \"\")) + \"; Body Mass (g): \" + (format(datum[\"Body Mass (g)\"], \"\")) + \"; Species: \" + (isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"])" }, "x": {"scale": "x", "field": "Flipper Length (mm)"}, "y": {"scale": "y", "field": "Body Mass (g)"}, "shape": {"scale": "shape", "field": "Species"} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": {"data": "source_0", "field": "Flipper Length (mm)"}, "range": [0, {"signal": "width"}], "zero": false, "nice": true }, { "name": "y", "type": "linear", "domain": {"data": "source_0", "field": "Body Mass (g)"}, "range": [{"signal": "height"}, 0], "zero": false, "nice": true }, { "name": "color", "type": "ordinal", "domain": {"data": "source_0", "field": "Species", "sort": true}, "range": "category" }, { "name": "shape", "type": "ordinal", "domain": {"data": "source_0", "field": "Species", "sort": true}, "range": "symbol" } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "Flipper Length (mm)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Body Mass (g)", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ], "legends": [ { "stroke": "color", "symbolType": "circle", "title": "Species", "encode": { "symbols": { "update": { "fill": {"value": "transparent"}, "opacity": {"value": 0.7} } } }, "shape": "shape" } ] }