{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 300, "height": 200, "style": "cell", "data": [ { "name": "source_0", "url": "data/movies.json", "format": {"type": "json"}, "transform": [ { "type": "filter", "expr": "(isValid(datum[\"IMDB Rating\"]) && isFinite(+datum[\"IMDB Rating\"])) && (isValid(datum[\"Rotten Tomatoes Rating\"]) && isFinite(+datum[\"Rotten Tomatoes Rating\"]))" }, { "type": "extent", "field": "IMDB Rating", "signal": "bin_maxbins_60_IMDB_Rating_extent" }, { "type": "bin", "field": "IMDB Rating", "as": [ "bin_maxbins_60_IMDB Rating", "bin_maxbins_60_IMDB Rating_end" ], "signal": "bin_maxbins_60_IMDB_Rating_bins", "extent": {"signal": "bin_maxbins_60_IMDB_Rating_extent"}, "maxbins": 60 }, { "type": "extent", "field": "Rotten Tomatoes Rating", "signal": "bin_maxbins_40_Rotten_Tomatoes_Rating_extent" }, { "type": "bin", "field": "Rotten Tomatoes Rating", "as": [ "bin_maxbins_40_Rotten Tomatoes Rating", "bin_maxbins_40_Rotten Tomatoes Rating_end" ], "signal": "bin_maxbins_40_Rotten_Tomatoes_Rating_bins", "extent": {"signal": "bin_maxbins_40_Rotten_Tomatoes_Rating_extent"}, "maxbins": 40 }, { "type": "aggregate", "groupby": [ "bin_maxbins_60_IMDB Rating", "bin_maxbins_60_IMDB Rating_end", "bin_maxbins_40_Rotten Tomatoes Rating", "bin_maxbins_40_Rotten Tomatoes Rating_end" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_60_IMDB Rating\"]) && isFinite(+datum[\"bin_maxbins_60_IMDB Rating\"]) && isValid(datum[\"bin_maxbins_40_Rotten Tomatoes Rating\"]) && isFinite(+datum[\"bin_maxbins_40_Rotten Tomatoes Rating\"])" } ] } ], "marks": [ { "name": "marks", "type": "rect", "style": ["rect"], "from": {"data": "source_0"}, "encode": { "update": { "fill": {"scale": "color", "field": "__count"}, "description": { "signal": "\"IMDB Rating (binned): \" + (!isValid(datum[\"bin_maxbins_60_IMDB Rating\"]) || !isFinite(+datum[\"bin_maxbins_60_IMDB Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_60_IMDB Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_60_IMDB Rating_end\"], \"\")) + \"; Rotten Tomatoes Rating (binned): \" + (!isValid(datum[\"bin_maxbins_40_Rotten Tomatoes Rating\"]) || !isFinite(+datum[\"bin_maxbins_40_Rotten Tomatoes Rating\"]) ? \"null\" : format(datum[\"bin_maxbins_40_Rotten Tomatoes Rating\"], \"\") + \" – \" + format(datum[\"bin_maxbins_40_Rotten Tomatoes Rating_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\"))" }, "x2": { "scale": "x", "field": "bin_maxbins_60_IMDB Rating", "offset": 0.5 }, "x": { "scale": "x", "field": "bin_maxbins_60_IMDB Rating_end", "offset": 0.5 }, "y2": { "scale": "y", "field": "bin_maxbins_40_Rotten Tomatoes Rating", "offset": 0.5 }, "y": { "scale": "y", "field": "bin_maxbins_40_Rotten Tomatoes Rating_end", "offset": 0.5 } } } } ], "scales": [ { "name": "x", "type": "linear", "domain": { "signal": "[bin_maxbins_60_IMDB_Rating_bins.start, bin_maxbins_60_IMDB_Rating_bins.stop]" }, "range": [0, {"signal": "width"}], "bins": {"signal": "bin_maxbins_60_IMDB_Rating_bins"}, "zero": false }, { "name": "y", "type": "linear", "domain": { "signal": "[bin_maxbins_40_Rotten_Tomatoes_Rating_bins.start, bin_maxbins_40_Rotten_Tomatoes_Rating_bins.stop]" }, "range": [{"signal": "height"}, 0], "bins": {"signal": "bin_maxbins_40_Rotten_Tomatoes_Rating_bins"}, "zero": false }, { "name": "color", "type": "linear", "domain": {"data": "source_0", "field": "__count"}, "range": "heatmap", "interpolate": "hcl", "zero": false } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": false, "title": "IMDB Rating (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/10)"}, "zindex": 1 }, { "scale": "y", "orient": "left", "grid": false, "title": "Rotten Tomatoes Rating (binned)", "labelOverlap": true, "tickCount": {"signal": "ceil(height/10)"}, "zindex": 1 } ], "legends": [ { "fill": "color", "gradientLength": {"signal": "clamp(height, 64, 200)"}, "title": "Count of Records" } ], "config": {"style": {"cell": {"stroke": "transparent"}}} }