viewof histogramMatrix = embed({
title: "Immigration measures by income group",
vconcat:[{
repeat: {column: z.getCol("Variable",incomeVarDefined)},
spec:{
data: {values: z.filter},
mark: "bar",
encoding: {
x: {
bin:{"binned": true, "step": 700000},
field:{"repeat":"column"},
type:"quantitative"
},
y: {
aggregate: "count",
field:"CO2",
type:"quantitative",
title: "Country Count"
}
}
}
},
{
repeat: {column: migVar},
spec:{
data: {values: z.filter(r => r["IncomeGroup"] === "Lower middle income", incomeVarDefined)},
mark: "bar",
encoding: {
x: {
bin:{"binned": true, "step": 700000},
field:{"repeat":"column"},
type:"quantitative"
},
y: {
aggregate: "count",
field:"CO2",
type:"quantitative",
title: "Country Count"
}
}
}
}
]
})