{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ {"name": "source_0", "url": "data/movies.json", "format": {"type": "json"}}, { "name": "data_0", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Rotten Tomatoes Rating\"]) && isFinite(+datum[\"Rotten Tomatoes Rating\"]) && isValid(datum[\"IMDB Rating\"]) && isFinite(+datum[\"IMDB Rating\"])" } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "loess", "x": "Rotten Tomatoes Rating", "y": "IMDB Rating", "as": ["Rotten Tomatoes Rating", "IMDB Rating"] } ] } ], "marks": [ { "name": "layer_0_marks", "type": "symbol", "style": ["point"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Rotten Tomatoes Rating: \" + (format(datum[\"Rotten Tomatoes Rating\"], \"\")) + \"; IMDB Rating: \" + (format(datum[\"IMDB Rating\"], \"\"))" }, "x": {"scale": "x", "field": "Rotten Tomatoes Rating"}, "y": {"scale": "y", "field": "IMDB Rating"} } } }, { "name": "layer_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"Rotten Tomatoes Rating\"]"}, "from": {"data": "data_1"}, "encode": { "update": { "stroke": {"value": "firebrick"}, "description": { "signal": "\"Rotten Tomatoes Rating: \" + (format(datum[\"Rotten Tomatoes Rating\"], \"\")) + \"; IMDB Rating: \" + (format(datum[\"IMDB Rating\"], \"\"))" }, "x": {"scale": "x", "field": "Rotten Tomatoes Rating"}, "y": {"scale": "y", "field": "IMDB Rating"}, "defined": { "signal": "isValid(datum[\"Rotten Tomatoes Rating\"]) && isFinite(+datum[\"Rotten Tomatoes Rating\"]) && isValid(datum[\"IMDB Rating\"]) && isFinite(+datum[\"IMDB Rating\"])" } } } } ], "scales": [ { "name": "x", "type": "linear", "domain": { "fields": [ {"data": "data_0", "field": "Rotten Tomatoes Rating"}, {"data": "data_1", "field": "Rotten Tomatoes Rating"} ] }, "range": [0, {"signal": "width"}], "nice": true, "zero": true }, { "name": "y", "type": "linear", "domain": { "fields": [ {"data": "data_0", "field": "IMDB Rating"}, {"data": "data_1", "field": "IMDB Rating"} ] }, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "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": "Rotten Tomatoes Rating", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "IMDB Rating", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }