map = Plot.plot({
margin: 0,
width: plotWidth,
height: plotWidth / 790 * 540,
x: {
label: null,
ticks: null
},
y: {
label: null,
ticks: null
},
color: {
type: 'threshold',
range: ['#d9d9d9', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#d94801'],
domain: [0, 0.15, 0.3, 0.45, 0.6],
},
marks: [
Plot.cell(plotData, {
x: stateX,
y: stateY,
fill: 'share',
rx: 10
}),
Plot.text(plotData, {
x: stateX,
y: stateY,
fontWeight: 'bold',
text: d => `${d.state}\n${valueFormat(d[outcome])}`
})
]
})