Plot.plot({
title: "CO2 Emissions between 1950 and 2000 for countries in EU",
color: { legend: false, scheme: "PuRd" , type: "categorical",className:"Region"},
x: { type: "linear" },
y: {},
marks: [
Plot.areaY(emissions_ue_world_sorted.filter(d => d.region === 'European Union'),
{x: "year", y: "co2",z:"country" ,fill: "order_eu",order:"-order_eu",
tip: {format: {x:true,y:true,z:true,fill:false,stroke:false}}}),
Plot.ruleY([0]),
Plot.text(
emissions_ue_world_sorted.filter(d => d.region === 'European Union'),
Plot.selectLast(
Plot.stackY({filter: (d) => (d.year < 1998),
x: "year", y: "co2",z:"country" ,fill: "order_eu",order:"-order_eu",
text:"country_formatted",
dx: -17,
fill: "#FFF"
}))
)
]
})