{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "url": "https://raw.githubusercontent.com/vega/vega-datasets/next/data/movies.json", "format": { "type": "json" }, "transform": [ { "type": "extent", "field": "IMDB Rating", "signal": "bin_maxbins_10_IMDB_Rating_extent" }, { "type": "bin", "field": "IMDB Rating", "as": [ "bin_maxbins_10_IMDB Rating", "bin_maxbins_10_IMDB Rating_end" ], "signal": "bin_maxbins_10_IMDB_Rating_bins", "extent": { "signal": "bin_maxbins_10_IMDB_Rating_extent" }, "maxbins": 10 }, { "type": "extent", "field": "Rotten Tomatoes Rating", "signal": "bin_maxbins_10_Rotten_Tomatoes_Rating_extent" }, { "type": "bin", "field": "Rotten Tomatoes Rating", "as": [ "bin_maxbins_10_Rotten Tomatoes Rating", "bin_maxbins_10_Rotten Tomatoes Rating_end" ], "signal": "bin_maxbins_10_Rotten_Tomatoes_Rating_bins", "extent": { "signal": "bin_maxbins_10_Rotten_Tomatoes_Rating_extent" }, "maxbins": 10 }, { "type": "aggregate", "groupby": [ "bin_maxbins_10_IMDB Rating", "bin_maxbins_10_IMDB Rating_end", "bin_maxbins_10_Rotten Tomatoes Rating", "bin_maxbins_10_Rotten Tomatoes Rating_end" ], "ops": [ "count" ], "fields": [ null ], "as": [ "__count" ] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_10_IMDB Rating\"]) && isFinite(+datum[\"bin_maxbins_10_IMDB Rating\"]) && isValid(datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"]) && isFinite(+datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"])" } ] } ], "marks": [ { "name": "marks", "type": "symbol", "style": [ "circle" ], "from": { "data": "source_0" }, "encode": { "update": { "fill": { "value": "#4c78a8" }, "ariaRoleDescription": { "value": "circle" }, "description": { "signal": "\"IMDB Rating (binned): \" + (!isValid(datum[\"bin_maxbins_10_IMDB Rating\"]) || !isFinite(+datum[\"bin_maxbins_10_IMDB Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_10_IMDB Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_IMDB Rating_end\"], \"\")) + \"; Rotten Tomatoes Rating (binned): \" + (!isValid(datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_Rotten Tomatoes Rating_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x": { "signal": "scale(\"x\", 0.5 * datum[\"bin_maxbins_10_IMDB Rating\"] + 0.5 * datum[\"bin_maxbins_10_IMDB Rating_end\"])" }, "y": { "signal": "scale(\"y\", 0.5 * datum[\"bin_maxbins_10_Rotten Tomatoes Rating\"] + 0.5 * datum[\"bin_maxbins_10_Rotten Tomatoes Rating_end\"])" }, "size": { "scale": "size", "field": "__count" }, "shape": { "value": "circle" } } } } ], "scales": [ { "name": "x", "type": "linear", "domain": { "signal": "[bin_maxbins_10_IMDB_Rating_bins.start, bin_maxbins_10_IMDB_Rating_bins.stop]" }, "range": [ 0, { "signal": "width" } ], "bins": { "signal": "bin_maxbins_10_IMDB_Rating_bins" }, "zero": false }, { "name": "y", "type": "linear", "domain": { "signal": "[bin_maxbins_10_Rotten_Tomatoes_Rating_bins.start, bin_maxbins_10_Rotten_Tomatoes_Rating_bins.stop]" }, "range": [ { "signal": "height" }, 0 ], "bins": { "signal": "bin_maxbins_10_Rotten_Tomatoes_Rating_bins" }, "zero": false }, { "name": "size", "type": "linear", "domain": { "data": "source_0", "field": "__count" }, "range": [ 4, { "signal": "pow(0.95 * min(width / ((bin_maxbins_10_IMDB_Rating_bins.stop - bin_maxbins_10_IMDB_Rating_bins.start) / bin_maxbins_10_IMDB_Rating_bins.step), height / ((bin_maxbins_10_Rotten_Tomatoes_Rating_bins.stop - bin_maxbins_10_Rotten_Tomatoes_Rating_bins.start) / bin_maxbins_10_Rotten_Tomatoes_Rating_bins.step)), 2)" } ], "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": false, "title": "IMDB Rating (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": { "signal": "ceil(width/10)" }, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Rotten Tomatoes Rating (binned)", "labelOverlap": true, "tickCount": { "signal": "ceil(height/10)" }, "zindex": 0 } ], "legends": [ { "size": "size", "symbolType": "circle", "title": "Count of Records", "encode": { "symbols": { "update": { "fill": { "value": "#4c78a8" }, "stroke": { "value": "transparent" } } } } } ] }