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