{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "url": "https://vega.github.io/vega-lite/data/cars.json" }, "description": "A scatterplot showing horsepower and miles per gallon for various cars with a global mean and standard deviation overlay.", "layer": [ { "encoding": { "x": { "field": "Horsepower", "type": "quantitative" }, "y": { "field": "Miles_per_Gallon", "type": "quantitative" } }, "mark": "point" }, { "layer": [ { "encoding": { "y": { "field": "mean_MPG", "type": "quantitative" } }, "mark": "rule" }, { "encoding": { "opacity": { "value": 0.2 }, "y": { "field": "lower", "type": "quantitative" }, "y2": { "field": "upper" } }, "mark": "rect" } ], "transform": [ { "aggregate": [ { "as": "mean_MPG", "field": "Miles_per_Gallon", "op": "mean" }, { "as": "dev_MPG", "field": "Miles_per_Gallon", "op": "stdev" } ], "groupby": [] }, { "as": "upper", "calculate": "datum.mean_MPG+datum.dev_MPG" }, { "as": "lower", "calculate": "datum.mean_MPG-datum.dev_MPG" } ] } ] }