Plot.plot({
width: width,
height: 250,
x: {label: null, ticks: 4, tickSize: 0, tickFormat: d => d + " mi"},
y: {label: null, ticks: 4, tickSize: 0, tickFormat: "$", domain: [d3.extent(data, d => d.gas)[0], 4]},
facet: {data, x: "series"},
fx: {label: null},
marks: [
Plot.text(data, {x: d3.median(data, d => d.miles), y: 3.8, text: (d, i) => (d.year == 1956 ? "Cheap gas, longer commutes" : d.year == 1973 ? "The Arab oil embargo" : d.year == 1975 ? "Energy Crisis" : d.year == 1982 ? "Record low prices" : d.year == 1999 ? "The swing backward" : ""), fontSize: 14, fontFamily: "Georgia", fontWeight: 800}),
Plot.line(data.slice(), {x: "miles", y: "gas", strokeWidth: 4, stroke: "gainsboro", curve: "catmull-rom"}),
Plot.line(data, {x: "miles", y: "gas", strokeWidth: 4, stroke: "#1e1e1e", curve: "catmull-rom"})
],
grid: true,
inset: 5
})