{ "$schema": "https://vega.github.io/schema/vega-lite/v4.json", "data": { "url": "https://vega.github.io/vega-lite/data/population.json" }, "description": "A trellis bar chart showing the US population distribution of age groups and gender in 2000", "encoding": { "color": { "field": "gender", "scale": { "range": [ "#EA98D2", "#659CCA" ] }, "type": "nominal" }, "row": { "field": "gender", "type": "nominal" }, "x": { "field": "age", "type": "ordinal" }, "y": { "aggregate": "sum", "axis": { "title": "Population" }, "field": "people", "type": "quantitative" } }, "mark": "bar", "transform": [ { "filter": "datum.year == 2000" }, { "as": "gender", "calculate": "datum.sex == 2 ? 'Female' : 'Male'" } ], "width": { "step": 17 } }