plot_other_industry_co2 = Plot.plot({
title: "CO2 emissions per year - Other Industry",
subtitle: "from 1980 to 2020",
width: width,
height: 500,
marginRight: 120,
color:{
type: "categorical",
legend: true,
domain: ["Italy", "Spain"],
range: ["blue", "red"],
},
y: {grid: true},
x: {grid: true},
marks: [
Plot.ruleY([0]),
Plot.lineY(dadesfiltrades, {
x: "year",
y: "other_industry_co2",
z: "country",
color: { legend: "country"},
stroke: "country"
}),
Plot.text(dadesfiltrades, Plot.selectLast({x: "year", y: "other_industry_co2", z: "country", text: "country", textAnchor: "start", dx: 3})),
Plot.text(dadesfiltrades, {filter: (d) => d.year % 5 === 0, x: "year", y: "other_industry_co2", text: (d) => `${d.other_industry_co2}`, dy: -12}),
Plot.circle(dadesfiltrades, { x: "year", y: "other_industry_co2", fill: "country" }),
]
});