{ "transform": [ { "filter": "isValid(datum.IMDB_Rating)" }, { "window": [ { "op": "mean", "as": "AverageRating", "field": "IMDB_Rating" } ], "frame": [ null, null ] }, { "filter": "(datum.IMDB_Rating - datum.AverageRating) > 2.5" } ], "data": { "url": "https://vega.github.io/vega-lite/data/movies.json" }, "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "layer": [ { "mark": "bar", "encoding": { "x": { "field": "IMDB_Rating", "type": "quantitative", "axis": { "title": "IMDB Rating" } }, "y": { "field": "Title", "type": "ordinal" } } }, { "mark": { "color": "red", "type": "rule" }, "encoding": { "x": { "field": "AverageRating", "aggregate": "mean", "type": "quantitative" } } } ], "description": "Calculation of difference from average" }