Bar Chart showing Initials of Month Names
Using labelExpr
to show only initial letters of month names.
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Using `labelExpr` to show only initial letters of month names.",
"data": {"url": "data/seattle-weather.csv"},
"mark": "bar",
"encoding": {
"x": {
"timeUnit": "month",
"field": "date",
"axis": {
"labelAlign": "left",
"labelExpr": "datum.label[0]"
}
},
"y": {"aggregate": "mean", "field": "precipitation"}
}
}