# Scatter Plot (Vega) ![Scatter plot](https://diagrams.gocapable.com/images/att1228046388.svg) ``` { "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "A scatter plot showing correlation between two variables.", "width": 400, "height": 200, "padding": 5, "data": [ { "name": "table", "values": [ {"x": 1, "y": 28}, {"x": 2, "y": 55}, {"x": 3, "y": 43}, {"x": 4, "y": 91}, {"x": 5, "y": 81}, {"x": 6, "y": 53}, {"x": 7, "y": 19}, {"x": 8, "y": 87} ] } ], "scales": [ { "name": "xscale", "type": "linear", "domain": {"data": "table", "field": "x"}, "range": "width" }, { "name": "yscale", "type": "linear", "domain": {"data": "table", "field": "y"}, "nice": true, "range": "height" } ], "axes": [ {"orient": "bottom", "scale": "xscale"}, {"orient": "left", "scale": "yscale"} ], "marks": [ { "type": "symbol", "from": {"data": "table"}, "encode": { "enter": { "x": {"scale": "xscale", "field": "x"}, "y": {"scale": "yscale", "field": "y"}, "size": {"value": 100}, "stroke": {"value": "steelblue"}, "fill": {"value": "transparent"} }, "update": { "fill": {"value": "steelblue"} }, "hover": { "fill": {"value": "red"} } } } ] } ```