gender_chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
svg.append("g").call(chart2_xAxis);
svg.append("g").call(chart2_yAxis);
svg
.append("g")
.selectAll("circle")
.data(gender_speed.filter(function(d) {return d.gender === selectedGender2}))
.join("circle")
.attr("fill", d => gender_color_scale2(d.gender))
.attr("stroke", "black")
.attr("opacity", 0.5)
.attr("cx", d => chart2_x(d.avg_sp_rd) + margin.left)
.attr("cy", d => chart2_y(d.num_runners))
.attr("r", "10px")
svg
.append("text")
.attr("x", width / 3)
.attr("y", height)
.text("Average Speed Throughout Race")
.style("font-size", "20px");
svg
.append("text")
.attr("transform", "translate(10, 300) rotate(-90)")
.text("Number of Runners")
.style("font-size", "20px");
svg
.append("text")
.attr("x", width / 3)
.attr("y", 15)
.text("Runners by Average Speed")
.style("font-size", "20px");
return svg.node();
}