Plot.plot({
width: width * 0.75,
aspectRatio: 2,
x: {
domain: [
_.min(expected_stats.map((e) => e[x])) * 0.9,
_.max(expected_stats.map((e) => e[x])) * 1.1
]
},
y: {
domain: [
_.min(expected_stats.map((e) => e[y])) * 0.9,
_.max(expected_stats.map((e) => e[y])) * 1.1
]
},
marks: [
Plot.ruleY([0]),
Plot.line(
[
[0, 0],
[1, 1]
],
{ stroke: "red", strokeDasharray: ".-" }
),
Plot.linearRegressionY(expected_stats, { x, y }),
Plot.image(expected_stats, {
x,
y,
src: (d) => get_headshot_url(d.player_id),
r: 20,
title: "last_name, first_name"
})
]
})