Public
Edited
May 5, 2023
Insert cell
Insert cell
Insert cell
socialDevelopmentFile = FileAttachment("social-development-wrangled@1.csv")
Insert cell
sdData = socialDevelopmentFile
.csv({typed: true})
.then((data) => data.map((d) => ({ ...d, Year: new Date(d.Year, 0) }))) // this correctly parses the dates
Insert cell
Insert cell
printTableTypes(sdData)
Insert cell
Insert cell
plot = vl.markLine()
.data(sdData)
.transform(
vl.filter('datum.country_code == "USA"')
)
.encode(
vl.x().fieldT('Year').timeUnit('year'),
vl.y().fieldQ('average_adolescent_fertility_rate')
)
.width(800)
Insert cell
printVegaLiteJSON(plot)
Insert cell
plot2 = vl.markLine()
.data(sdData)
.transform(
vl.filter('datum.country_code == "USA"')
)
.encode(
vl.x().fieldN('Year'),
vl.y().fieldQ('average_adolescent_fertility_rate')
)
.width(800)
Insert cell
Insert cell
plot.render()
Insert cell
plot2.render()
Insert cell
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {printTable} from '@jonfroehlich/data-utilities'
Insert cell
import {printTableTypes} from '@jonfroehlich/data-utilities'
Insert cell
import {printVegaLiteJSON} from "@jonfroehlich/vega-lite-utilities"
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