scatterplotSVG = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
svg
.append("g")
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x).ticks(width / 160))
.call(g =>
g
.append("text")
.attr("x", width)
.attr("y", margin.bottom - 4)
.attr("fill", "currentColor")
.attr("text-anchor", "end")
.text(attributeX)
);
svg
.append("g")
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y))
.call(g =>
g
.append("text")
.attr("x", -margin.left)
.attr("y", 10)
.attr("fill", "currentColor")
.attr("text-anchor", "start")
.text(attributeY)
);
svg
.append("rect")
.attr("x", margin.left)
.attr("y", margin.top)
.attr("width", width - margin.left - margin.right)
.attr("height", height - margin.top - margin.bottom)
.attr("fill", backgroundColor)
.attr("class", movies);
svg.selectAll("dot")
.data(movies)
.enter().append("circle")
.attr("cx",function(d) { return x(d[attributeX]); })
.attr("cy",function(d) { return y(d[attributeY]); })
.attr("r",function(d) { return d["rating"]*0.7;})
.attr("fill", function(d) {return (d["original_language"]=="en") ? "#0EABBF" : "#C410A1";})
.attr("stroke","black");
return svg.node();
}