Published
Edited
May 6, 2022
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
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
Insert cell
// ... include only 'FL', 'CA', 'TX', 'WA', 'MI'
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
// ... switch x and y
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
// ...
Insert cell
Insert cell
Insert cell
// ... return an array of values from Wrangler() instead of using 'objects()' as usual
Insert cell
Insert cell
// ageGroups_reversed = ageGroups.reverse() // erronous due to a bug: it changes the bar locations
Insert cell
Insert cell
Insert cell
Insert cell
// ... you can specify facet options
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
Insert cell
// ... change width for more compact chart
// ... increase left margin to prevent axis label overlapping with column names
// ... Use an empty value at the end of the 'domain' list to skip the very light yellow
// ... add vertical grid line
// ... increase the number of ticks
// ... add arrowhead to x axis label
// ... color age group labels
// ... add some offset to x positions of text to place them on the right side of the bars
Insert cell
Insert cell
Insert cell
Insert cell
// d3.select(myPlot)
// .selectAll('g[aria-label="fy-axis"]')
// .selectAll('.tick')
// .selectAll('text')
// .style('font-size', '10pt')
Insert cell
Insert cell
// d3.select(myPlot)
// .selectAll('g[aria-label="fy-axis"]')
// .selectAll('text[text-anchor="middle"]')
// .style('font-size', '10pt')
Insert cell
Insert cell
// ...
Insert cell
Insert cell
Insert cell
Insert cell
// ...
Insert cell
Insert cell
FileAttachment("CleanShot 2022-05-06 at 03.19.06-2x.png").image({width: 220})
Insert cell
// ... remember to return an array of values from Wrangler()
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