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);
svg
.selectAll("circle")
.data(movies)
.enter()
.append("circle")
.attr("stroke", blueColor)
.attr("stroke-width", 1)
.attr("fill", d => highlightOtherLanguagesThanEnglish(d["original_language"]))
.attr("cx", d => x(d[attributeX]))
.attr("cy", d => y(d[attributeY]))
.attr("r", d => mapSize(radius, d["rating"]))
return svg.node();
}