Public
Edited
May 18
Insert cell
Insert cell
import {vl} from "@vega/vega-lite-api-v5"
Insert cell
import {printTable} from "@uwdata/data-utilities"
Insert cell
ghgs_inventory = FileAttachment("greenhouse_gas_emissions_inventory@1.csv").csv()
Insert cell
printTable(ghgs_inventory.slice(0, 5)) // display the first five rows
Insert cell
vl.markArea({ interpolate: 'basis' })
.data(ghgs_inventory)
.transform(
vl.filter("datum.POLLUTANT != 'GHG' && datum.POLLUTANT != 'CO2' && datum.UNIT_MEASURE == 'T_CO2E'"),
vl.groupby(['POLLUTANT', 'TIME_PERIOD'])
.aggregate(vl.sum('OBS_VALUE').as('Total_Emissions'))
)
.encode(
vl.x().fieldT('TIME_PERIOD').title('Year'),
vl.y()
.fieldQ('Total_Emissions')
.stack('zero')
.title('Total Emissions (Tonnes of CO₂-equivalent)'),
vl.color()
.fieldN('POLLUTANT')
.title('Greenhouse Gas (GHG) Type'),
vl.tooltip([
vl.fieldN('POLLUTANT'),
vl.fieldT('TIME_PERIOD'),
vl.fieldQ('Total_Emissions')
])
)
.title('Global Greenhouse Gas Emissions Over Time (by Gas Type)')
.render()
Insert cell
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