scatterplot = {
const svg = d3.create("svg")
.attr("width", 350)
.attr("height", 350)
const margin = { top: 20, right: 20, bottom: 30, left: 40 };
const width = 350;
const height = 350;
const filteredData = iris.filter(d => d.Species === especie);
const xScale = d3.scaleLinear()
.domain(d3.extent(filteredData, d => +d[xAttr])).nice()
.range([margin.left, width - margin.right]);
const yScale = d3.scaleLinear()
.domain(d3.extent(filteredData, d => +d[yAttr])).nice()
.range([height - margin.bottom, margin.top]);
svg.append("g")
.attr("transform", `translate(0, ${height - margin.bottom})`)
.call(d3.axisBottom(xScale));
svg.append("g")
.attr("transform", `translate(${margin.left}, 0)`)
.call(d3.axisLeft(yScale));
svg.append("text")
.attr("x", width / 2)
.attr("y", height - 5)
.attr("text-anchor", "middle")
.text(xAttr);
svg.append("text")
.attr("transform", "rotate(-90)")
.attr("x", -height / 2)
.attr("y", 12)
.attr("text-anchor", "middle")
.text(yAttr);
svg.append("g")
.selectAll("circle")
.data(filteredData)
.join("circle")
.attr("cx", d => xScale(+d[xAttr]))
.attr("cy", d => yScale(+d[yAttr]))
.attr("r", 4)
.attr("fill", "#69b3a2")
.attr("opacity", 0.75);
return svg.node();
}