scatter2 = {
const svgwidth = 800;
const svgheight = 500;
const margin = { top: 20, right: 20, bottom: 40, left: 50 };
const outersvg = d3.select(DOM.svg(svgwidth + margin.left + margin.right,
svgheight + margin.top + margin.bottom));
const svg = outersvg.append('g')
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
const dataset = countries.map(d => [d.fertility, d.life_expect]);
const xScale = d3.scaleLinear()
.domain([0, d3.max(dataset, d => d[0]) + 0.5])
.range([0, svgwidth]);
const yScale = d3.scaleLinear()
.domain([40, d3.max(dataset, d => d[1]) + 5])
.range([svgheight, 0]);
const xAxis = d3.axisBottom(xScale);
const yAxis = d3.axisLeft(yScale);
svg.selectAll('circle')
.data(dataset)
.enter()
.append('circle')
.attr('cx', d => xScale(d[0]))
.attr('cy', d => yScale(d[1]))
.attr('r', 5)
.attr('fill', 'steelblue');
svg.append("g")
.attr("transform", "translate(0," + svgheight + ")")
.call(xAxis)
.append("text")
.attr("x", svgwidth / 2)
.attr("y", 35)
.attr("fill", "black")
.style("font-size", "12px")
.text("Fertility");
svg.append("g")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("x", (-svgheight / 2) + 30)
.attr("y", -35)
.attr("fill", "black")
.style("font-size", "12px")
.text("Life Expectancy");
return outersvg.node();
}