scatterPlot = {
const margin = { top: 20, right: 30, bottom: 30, left: 40 };
const width = 500 - margin.left - margin.right;
const height = 300 - margin.top - margin.bottom;
const svg = d3.create('svg')
.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom);
const group = svg.append('g')
.attr('transform', `translate(${margin.left},${margin.top})`);
const xScale = d3.scaleLinear()
.domain(d3.extent(data_cleaned, d => d.Length))
.range([0, width]);
const yScale = d3.scaleLinear()
.domain(d3.extent(data_cleaned, d => d.Beam))
.range([height, 0]);
const colorScale = d3.scaleOrdinal()
.domain(['Battleship', 'Carrier', 'Cruiser'])
.range(['red', 'lightblue', 'green']);
group.selectAll('circle')
.data(data_cleaned)
.enter()
.append('circle')
.attr('cx', d => xScale(d.Length))
.attr('cy', d => yScale(d.Beam))
.attr('r', 5)
.attr('fill', d => colorScale(d.Type));
group.append('g')
.attr('transform', `translate(0,${height})`)
.call(d3.axisBottom(xScale));
group.append('g')
.call(d3.axisLeft(yScale));
return svg.node();
}