points_and_contours = {
let thresholds = d3.range(0, 1, 1/40);
let contours = d3.contours()
.size([100, 100])
.thresholds(thresholds);
let contour_groups = contours(predictions);
const projection = d3.geoIdentity()
.fitSize([size, size], contour_groups[1]);
let path = d3.geoPath()
.projection(projection);
main.selectAll("path").remove();
main.selectAll("path")
.data(contour_groups)
.enter()
.append('path')
.attr("d", path)
.attr("fill", cg => color_scale(cg.value))
.attr('opacity', .2);
main.selectAll('circle').remove()
let p = main.selectAll('circle')
.data(data)
.enter()
.append('circle')
.attr('cx', d => x1_scale(d.x1))
.attr('cy', d => x2_scale(d.x2))
.attr('r', 3)
.attr('fill', d => d.y == 0 ? 'pink' : 'lightblue')
.attr('stroke', d => d.y == 0 ? 'red' : 'blue')
.attr('stroke-width', 2);
}