embed(
{
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
"data": {"values": weather},
"transform": [{"filter": "datum.location == 'Seattle'"}],
"title": "Seattle Weather Dashboard",
"resolve": {"legend": {"color": "independent"}},
"config": {"axis": {"labelAngle": 0}},
"vconcat": [
{
"hconcat": [
{
"repeat": {
"row": ['temp_max', 'precipitation', 'wind'],
"column": ['temp_max', 'precipitation', 'wind']},
"spec": {
"width": 125,
"height": 125,
"mark": {"type": "circle", "size": 15, "opacity":0.5, tooltip: true},
"encoding": {
"x": {"field": {"repeat": "column"}, "type": "quantitative"},
"y": {"field": {"repeat": "row"}, "type": "quantitative"},
}
}
},
{
"repeat": {"row": ['temp_max', 'precipitation', 'wind']},
"spec": {
"width": 175,
"height": 125,
"layer": [
{
"mark": {type: "bar", tooltip: true},
"encoding": {
"x": {"field": "date", "type": "ordinal", "timeUnit": "month", "title": "Month"},
"y": {"field": {"repeat": "row"}, "type": "quantitative", "aggregate": "average"}
}
},
{
"mark": {"type": "rule", "stroke": "firebrick"},
"encoding": {
"y": {"field": {"repeat": "row"}, "type": "quantitative", "aggregate": "average"}
}
}
]
}
}
]},
{
"facet": {"column": {"field": "weather"}},
"spec": {
"mark": {type: "bar", tooltip: true},
"width": 115,
"height": 100,
"encoding": {
"x": {"field": "temp_max", "type": "quantitative", "bin": true, "title": "Temperature (°C)"},
"y": {"aggregate": "count", "type": "quantitative"},
"color": {"field": "weather", "type": "nominal",
"scale": {"domain": ["drizzle", "fog", "rain", "snow", "sun"],
"range": ["#aec7e8", "#c7c7c7", "#1f77b4", "#9467bd", "#e7ba52"]}}
}
}
}
]
})