Published
Edited
May 12, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = FileAttachment("us-population-state-age.csv").csv()
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(data)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [Plot.barY(data, { x: "name", y: "20-29" }), Plot.ruleY([0])]
})
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1000,
marks: [Plot.barY(data, { x: "name", y: "20-29" }), Plot.ruleY([0])] // x axis at y=0
})
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 1000,
marginLeft: 100,
marks: [
Plot.barY(data, {
x: "name",
y: (d) => d["20-29"]
})
]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 900,
x: {
label: "ꜛState"
},
y: {
transform: (d) => d / 1_000_000,
label: "ꜛMillion People"
},
marks: [Plot.barY(data, { x: "name", y: (d) => d["20-29"] })]
})
Insert cell
Insert cell
Insert cell
Plot.plot({
width: 900,
x: {
label: "ꜛState"
},
y: {
transform: (d) => d / 1_000_000,
label: "ꜛMillion People"
},
marks: [
Plot.barY(data, {
x: "name",
y: (d) => d["20-29"],
sort: {
x: "y",
reverse: true
}
})
]
})
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
ageRangeToFocus = "≥80"
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
// ... the dropdown menu should let the user select from '<10', '10-19', '20-29', '30-39', '40-49', '50-59', '60-69', '70-79', '≥80'
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
// ...
Insert cell
Insert cell
// import {Wrangler, op} from "@observablehq/data-wrangler"
Insert cell
Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
import {imageToDo} from "@clokman/student-blocks"
Insert cell
imageToDo
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