Public
Edited
Dec 14, 2023
Insert cell
Insert cell
world_bank_data.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
marginLeft: 180,
x: {grid: true},
color: {scheme: "reds"},
marks: [
Plot.barX(
world_bank_data.filter((d) => (d.year === 2004 && d.co2 / d.population > 0.01)), {
x: (d) => (d.co2 / d.population),
y: "country",
fill: (d) => (d.co2 / d.population),
sort: {"y": "-x"},
}),
Plot.text(
world_bank_data.filter((d) => (d.year === 2004 && d.co2 / d.population > 0.01)), {
x: (d) => (d.co2 / d.population),
y: "country",
text: (d) => (d.co2 / d.population),
textAnchor: "start"
})
]
})
Insert cell
gdp_co2_plot = Plot.plot({
title: "Annual GDP & C02 Emissions by Country",
caption: "Data Source: World Bank",
y: {grid: true, type: "log"},
x: {grid: true, type: "log"},
color: {legend: true},
marks: [
Plot.dot(world_bank_data, {
x: "gdp",
y: "co2",
fill: "region",
filter: d => (d.year === 2019),
tip: true
}),
Plot.linearRegressionX(world_bank_data, {
x: "gdp",
y: "co2",
filter: d => (d.year === 2019)
})
]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more