Plot.plot({
grid:true,
inset: 10,
width: 920,
height: 800,
color: {scheme:"YlGnBu"},
x:{domain:d3.extent(data, d=> d.x)},
y:{domain:d3.extent(data, d=> d.y)},
facet: {data:data2,
x: d => d.player_index % 5,
y: d => Math.round(d.player_index / 5)},
marks:[
Plot.frame(),
Plot.image(bg,{x:60, y:40, width: 800/5, height: 500/5, src: "url"}),
Plot.dot(data2.slice(),{x:"x", y:"y", fill:"team_name", r:1, fill:"lightgray"}),
Plot.dot(data2,{x:"x", y:"y", fill:"team_name"}),
Plot.dot(data2,{filter: d => d.shot_outcome == "Goal", x:"x", y:"y", fill:"red", r:5}),
Plot.text(data2, { x:960/5/5 ,
y:540/5/2,
textSize:20,
textAnchor:"left",
text:"player_name"})
]
})