addTooltips(
Plot.plot({
facet: {
data: distances,
y: "result"
},
width,
marginLeft: 100,
marks: [
Plot.dot(
distances,
Plot.hexbin(
{ r: "count", title: (v) => `Shots: ${v.length} \n ${v[0].player}` },
{ x: "distance", y: "player", fill: "result" }
)
),
Plot.ruleX([22], { strokeDasharray: [2, 2] })
],
color: {
legend: true
},
y: {
label: null,
grid: true
}
})
)