Plot.plot({
height: 600,
marginRight: 40,
x: {
label: "Median annual income (men, thousands) →",
tickFormat: d => d / 1000
},
y: {
label: "↑ Median annual income (women, thousands)",
tickFormat: d => d / 1000
},
marks: [
Plot.link([1], {
x1: () => incdomain[0],
y1: () => incdomain[0],
x2: () => incdomain[1],
y2: () => incdomain[1]
}),
Plot.link([0.6, 0.7, 0.8, 0.9], {
x1: () => incdomain[0],
y1: k => incdomain[0] * k,
x2: () => incdomain[1],
y2: k => incdomain[1] * k,
strokeOpacity: 0.2
}),
Plot.text([0.6, 0.7, 0.8, 0.9, 1.0], {
x: () => incdomain[1],
y: k => incdomain[1] * k,
text: d => d === 1 ? "Equal" : d3.format("+.0%")(d - 1),
textAnchor: "start",
dx: 6
}),
Plot.dot(income, {x: "m", y: "f", title: d => `${d.type}, ${d.age}`})
]
})