{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "data": [ { "name": "source_0", "url": "data/cars.json", "format": {"type": "json"}, "transform": [ { "type": "extent", "field": "Displacement", "signal": "child__Displacement_bin_maxbins_10_Displacement_extent" }, { "type": "bin", "field": "Displacement", "as": [ "bin_maxbins_10_Displacement", "bin_maxbins_10_Displacement_end" ], "signal": "child__Displacement_bin_maxbins_10_Displacement_bins", "extent": { "signal": "child__Displacement_bin_maxbins_10_Displacement_extent" }, "maxbins": 10 }, { "type": "extent", "field": "Horsepower", "signal": "child__Horsepower_bin_maxbins_10_Horsepower_extent" }, { "type": "bin", "field": "Horsepower", "as": ["bin_maxbins_10_Horsepower", "bin_maxbins_10_Horsepower_end"], "signal": "child__Horsepower_bin_maxbins_10_Horsepower_bins", "extent": { "signal": "child__Horsepower_bin_maxbins_10_Horsepower_extent" }, "maxbins": 10 }, { "type": "extent", "field": "Miles_per_Gallon", "signal": "child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_extent" }, { "type": "bin", "field": "Miles_per_Gallon", "as": [ "bin_maxbins_10_Miles_per_Gallon", "bin_maxbins_10_Miles_per_Gallon_end" ], "signal": "child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_bins", "extent": { "signal": "child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_extent" }, "maxbins": 10 }, { "type": "extent", "field": "Acceleration", "signal": "child__Acceleration_bin_maxbins_10_Acceleration_extent" }, { "type": "bin", "field": "Acceleration", "as": [ "bin_maxbins_10_Acceleration", "bin_maxbins_10_Acceleration_end" ], "signal": "child__Acceleration_bin_maxbins_10_Acceleration_bins", "extent": { "signal": "child__Acceleration_bin_maxbins_10_Acceleration_extent" }, "maxbins": 10 } ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_10_Displacement", "bin_maxbins_10_Displacement_end", "Origin" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "stack", "groupby": [ "bin_maxbins_10_Displacement", "bin_maxbins_10_Displacement_end" ], "field": "__count", "sort": {"field": ["Origin"], "order": ["descending"]}, "as": ["__count_start", "__count_end"], "offset": "zero" }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_10_Displacement\"]) && isFinite(+datum[\"bin_maxbins_10_Displacement\"])" } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_10_Horsepower", "bin_maxbins_10_Horsepower_end", "Origin" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "stack", "groupby": [ "bin_maxbins_10_Horsepower", "bin_maxbins_10_Horsepower_end" ], "field": "__count", "sort": {"field": ["Origin"], "order": ["descending"]}, "as": ["__count_start", "__count_end"], "offset": "zero" }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_10_Horsepower\"]) && isFinite(+datum[\"bin_maxbins_10_Horsepower\"])" } ] }, { "name": "data_2", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_10_Miles_per_Gallon", "bin_maxbins_10_Miles_per_Gallon_end", "Origin" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "stack", "groupby": [ "bin_maxbins_10_Miles_per_Gallon", "bin_maxbins_10_Miles_per_Gallon_end" ], "field": "__count", "sort": {"field": ["Origin"], "order": ["descending"]}, "as": ["__count_start", "__count_end"], "offset": "zero" }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_10_Miles_per_Gallon\"]) && isFinite(+datum[\"bin_maxbins_10_Miles_per_Gallon\"])" } ] }, { "name": "data_3", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": [ "bin_maxbins_10_Acceleration", "bin_maxbins_10_Acceleration_end", "Origin" ], "ops": ["count"], "fields": [null], "as": ["__count"] }, { "type": "stack", "groupby": [ "bin_maxbins_10_Acceleration", "bin_maxbins_10_Acceleration_end" ], "field": "__count", "sort": {"field": ["Origin"], "order": ["descending"]}, "as": ["__count_start", "__count_end"], "offset": "zero" }, { "type": "filter", "expr": "isValid(datum[\"bin_maxbins_10_Acceleration\"]) && isFinite(+datum[\"bin_maxbins_10_Acceleration\"])" } ] } ], "signals": [ {"name": "childWidth", "value": 200}, {"name": "childHeight", "value": 200} ], "layout": {"padding": 20, "columns": 2, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__Horsepower_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__Horsepower_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_1"}, "encode": { "update": { "fill": {"scale": "color", "field": "Origin"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Horsepower (binned): \" + (!isValid(datum[\"bin_maxbins_10_Horsepower\"]) || !isFinite(+datum[\"bin_maxbins_10_Horsepower\"]) ? \"null\" : format(datum[\"bin_maxbins_10_Horsepower\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_Horsepower_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x2": { "scale": "child__Horsepower_x", "field": "bin_maxbins_10_Horsepower", "offset": 1 }, "x": { "scale": "child__Horsepower_x", "field": "bin_maxbins_10_Horsepower_end" }, "y": {"scale": "child__Horsepower_y", "field": "__count_end"}, "y2": {"scale": "child__Horsepower_y", "field": "__count_start"} } } } ], "axes": [ { "scale": "child__Horsepower_y", "orient": "left", "gridScale": "child__Horsepower_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__Horsepower_x", "orient": "bottom", "grid": false, "title": "Horsepower (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/10)"}, "zindex": 0 }, { "scale": "child__Horsepower_y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__Miles_per_Gallon_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__Miles_per_Gallon_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_2"}, "encode": { "update": { "fill": {"scale": "color", "field": "Origin"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Miles_per_Gallon (binned): \" + (!isValid(datum[\"bin_maxbins_10_Miles_per_Gallon\"]) || !isFinite(+datum[\"bin_maxbins_10_Miles_per_Gallon\"]) ? \"null\" : format(datum[\"bin_maxbins_10_Miles_per_Gallon\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_Miles_per_Gallon_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x2": { "scale": "child__Miles_per_Gallon_x", "field": "bin_maxbins_10_Miles_per_Gallon", "offset": 1 }, "x": { "scale": "child__Miles_per_Gallon_x", "field": "bin_maxbins_10_Miles_per_Gallon_end" }, "y": { "scale": "child__Miles_per_Gallon_y", "field": "__count_end" }, "y2": { "scale": "child__Miles_per_Gallon_y", "field": "__count_start" } } } } ], "axes": [ { "scale": "child__Miles_per_Gallon_y", "orient": "left", "gridScale": "child__Miles_per_Gallon_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__Miles_per_Gallon_x", "orient": "bottom", "grid": false, "title": "Miles_per_Gallon (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/10)"}, "zindex": 0 }, { "scale": "child__Miles_per_Gallon_y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__Acceleration_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__Acceleration_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_3"}, "encode": { "update": { "fill": {"scale": "color", "field": "Origin"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Acceleration (binned): \" + (!isValid(datum[\"bin_maxbins_10_Acceleration\"]) || !isFinite(+datum[\"bin_maxbins_10_Acceleration\"]) ? \"null\" : format(datum[\"bin_maxbins_10_Acceleration\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_Acceleration_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x2": { "scale": "child__Acceleration_x", "field": "bin_maxbins_10_Acceleration", "offset": 1 }, "x": { "scale": "child__Acceleration_x", "field": "bin_maxbins_10_Acceleration_end" }, "y": {"scale": "child__Acceleration_y", "field": "__count_end"}, "y2": {"scale": "child__Acceleration_y", "field": "__count_start"} } } } ], "axes": [ { "scale": "child__Acceleration_y", "orient": "left", "gridScale": "child__Acceleration_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__Acceleration_x", "orient": "bottom", "grid": false, "title": "Acceleration (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/10)"}, "zindex": 0 }, { "scale": "child__Acceleration_y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__Displacement_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__Displacement_marks", "type": "rect", "style": ["bar"], "from": {"data": "data_0"}, "encode": { "update": { "fill": {"scale": "color", "field": "Origin"}, "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Displacement (binned): \" + (!isValid(datum[\"bin_maxbins_10_Displacement\"]) || !isFinite(+datum[\"bin_maxbins_10_Displacement\"]) ? \"null\" : format(datum[\"bin_maxbins_10_Displacement\"], \"\") + \" – \" + format(datum[\"bin_maxbins_10_Displacement_end\"], \"\")) + \"; Count of Records: \" + (format(datum[\"__count\"], \"\")) + \"; Origin: \" + (isValid(datum[\"Origin\"]) ? datum[\"Origin\"] : \"\"+datum[\"Origin\"])" }, "x2": { "scale": "child__Displacement_x", "field": "bin_maxbins_10_Displacement", "offset": 1 }, "x": { "scale": "child__Displacement_x", "field": "bin_maxbins_10_Displacement_end" }, "y": {"scale": "child__Displacement_y", "field": "__count_end"}, "y2": {"scale": "child__Displacement_y", "field": "__count_start"} } } } ], "axes": [ { "scale": "child__Displacement_y", "orient": "left", "gridScale": "child__Displacement_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__Displacement_x", "orient": "bottom", "grid": false, "title": "Displacement (binned)", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(childWidth/10)"}, "zindex": 0 }, { "scale": "child__Displacement_y", "orient": "left", "grid": false, "title": "Count of Records", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "color", "type": "ordinal", "domain": { "fields": [ {"data": "data_1", "field": "Origin"}, {"data": "data_2", "field": "Origin"}, {"data": "data_3", "field": "Origin"}, {"data": "data_0", "field": "Origin"} ], "sort": true }, "range": "category" }, { "name": "child__Horsepower_x", "type": "linear", "domain": { "signal": "[child__Horsepower_bin_maxbins_10_Horsepower_bins.start, child__Horsepower_bin_maxbins_10_Horsepower_bins.stop]" }, "range": [0, {"signal": "childWidth"}], "bins": {"signal": "child__Horsepower_bin_maxbins_10_Horsepower_bins"}, "zero": false }, { "name": "child__Horsepower_y", "type": "linear", "domain": {"data": "data_1", "fields": ["__count_start", "__count_end"]}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__Miles_per_Gallon_x", "type": "linear", "domain": { "signal": "[child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_bins.start, child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_bins.stop]" }, "range": [0, {"signal": "childWidth"}], "bins": { "signal": "child__Miles_per_Gallon_bin_maxbins_10_Miles_per_Gallon_bins" }, "zero": false }, { "name": "child__Miles_per_Gallon_y", "type": "linear", "domain": {"data": "data_2", "fields": ["__count_start", "__count_end"]}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__Acceleration_x", "type": "linear", "domain": { "signal": "[child__Acceleration_bin_maxbins_10_Acceleration_bins.start, child__Acceleration_bin_maxbins_10_Acceleration_bins.stop]" }, "range": [0, {"signal": "childWidth"}], "bins": { "signal": "child__Acceleration_bin_maxbins_10_Acceleration_bins" }, "zero": false }, { "name": "child__Acceleration_y", "type": "linear", "domain": {"data": "data_3", "fields": ["__count_start", "__count_end"]}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__Displacement_x", "type": "linear", "domain": { "signal": "[child__Displacement_bin_maxbins_10_Displacement_bins.start, child__Displacement_bin_maxbins_10_Displacement_bins.stop]" }, "range": [0, {"signal": "childWidth"}], "bins": { "signal": "child__Displacement_bin_maxbins_10_Displacement_bins" }, "zero": false }, { "name": "child__Displacement_y", "type": "linear", "domain": {"data": "data_0", "fields": ["__count_start", "__count_end"]}, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } ], "legends": [{"fill": "color", "symbolType": "square", "title": "Origin"}] }