{
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("width", width)
.attr("height", height);
let circles = svg
.selectAll("circle")
.data(points)
.enter()
.filter((d) => {
let x = Math.floor(d[0] * width),
y = Math.floor(d[1] * width);
var data = context.getImageData(x, y, 1, 1).data;
var rgb = [data[0], data[1], data[2]];
return data[3] !== 0;
})
.append("circle")
.attr("cx", (d) => d[0] * width)
.attr("cy", (d) => d[1] * width)
.attr("r", radius)
.attr("fill", (d) => dotColour(d[0]));
return svg.node();
}