Public
Edited
May 29
Insert cell
Insert cell
Insert cell
Insert cell
import {vl} from "@vega/vega-lite-api-v5"
Insert cell
import {printTable} from "@uwdata/data-utilities"
Insert cell
census = FileAttachment("census2000.csv").csv()
Insert cell
printTable(census.slice(0, 5))
Insert cell
vl.markBar()
.data(census)
.transform(
vl.groupby(['Age', 'Year'])
.aggregate(vl.sum('People').as('TotalPeople'))
)
.encode(
vl.x().fieldN('Age').sort('mean').title(['Age Group', '(in five-year intervals)']),
vl.y().fieldQ('TotalPeople').title('U.S. Population'),
vl.color().fieldN('Year'),
vl.xOffset().fieldN('Year'),
vl.tooltip().fieldQ('TotalPeople').format(',')
)
.width(600)
.height(400)
.title(['How has the age distribution','of the U.S. population changed from 1900 to 2000?'])
.render()
Insert cell
Insert cell
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