scatter_plot = {
const width = 500;
const height = 300;
const margin = { top: 30, right: 30, bottom: 30, left: 30 };
const xScale = d3
.scaleLinear()
.domain([0, d3.max(dataset, (d) => d.Movie)])
.range([margin.left, width - margin.right]);
const yScale = d3
.scaleLinear()
.domain([0, d3.max(dataset, (d) => d.Real)])
.range([height - margin.bottom, margin.top]);
const color = d3
.scaleOrdinal()
.domain([...Genre.keys()])
.range(d3.schemeTableau10);
const xAxis = d3.axisBottom().scale(xScale).ticks(10);
const yAxis = d3.axisLeft().scale(yScale).ticks(5);
const svg = d3.create("svg").attr("width", width).attr("height", height);
svg
.append("g")
.attr("class", "xAxis")
.attr("transform", `translate(0, ${height - margin.bottom})`)
.call(xAxis);
svg
.append("g")
.attr("class", "yAxis")
.attr("transform", `translate(${margin.left}, 0)`)
.call(yAxis);
svg
.selectAll("circle")
.data(dataset)
.join("circle")
.attr("cx", (d) => xScale(d.Movie))
.attr("cy", (d) => yScale(d.Real))
.attr("r", 5)
.attr("fill", (d) => color(d.Genre))
.append("title")
.text((d) => `${d.Title}`);
svg
.selectAll("g.xAxis, g.yAxis")
.selectAll("line, path")
.attr("stroke", "white")
.attr("opacity", 0.5);
return svg.node();
}