viewof view_histogram2 = embed({
title: "Immigration by income groups and migration categories",
vconcat:[{
repeat:{column:variable},
spec:{
data: {values: migNew[migGroup_key[0]]},
mark:"bar",
encoding: {
x: {bin:{"maxbins":13}, field:{"repeat":"column"}, type: "quantitative"},
y: {aggregate:"count", field:"CO2", type: "quantitative",title:"number of country",scale:{domain:[0,200]}}
}}},
{
repeat:{column:variable},
spec:{
data: {values: migNew[migGroup_key[1]]},
mark:"bar",
encoding: {
x: {bin:{"maxbins":13}, field:{"repeat":"column"}, type: "quantitative"},
y: {aggregate:"count", field:"CO2", type: "quantitative", title:"number of country"}
}}},
{
repeat:{column:variable},
spec:{
data: {values: migNew[migGroup_key[2]]},
mark:"bar",
encoding: {
x: {bin:{"maxbins":13}, field:{"repeat":"column"}, type: "quantitative"},
y: {aggregate:"count", field:"CO2", type: "quantitative", title:"number of country"}
}}},
{
repeat:{column:variable},
spec:{
data: {values: migNew[migGroup_key[3]]},
mark:"bar",
encoding: {
x: {bin:{"maxbins":13}, field:{"repeat":"column"}, type: "quantitative"},
y: {aggregate:"count", field:"CO2", type: "quantitative", title:"number of country"}
}}}
]
})