var scatterPlot = ScatterPlot(); scatterPlot .outerWidth(960) .outerHeight(500) .margin({ left: 95, top: 5, right: 10, bottom: 85 }) .xColumn("sepal_length") .xAxisLabel("Sepal Length (cm)") .xAxisLabelOffset(70) .xTicks(20) .yColumn("petal_length") .yAxisLabel("Petal Length (cm)") .yAxisLabelOffset(50) .yTicks(20) .colorColumn("species") .rColumn("sepal_width")// "r" stands for radius .rMin(2) .rMax(13) .colorRange(["#00c65c", "#8400c6", "#e54100"]); function type(d){ d.sepal_length = +d.sepal_length; d.sepal_width = +d.sepal_width; d.petal_length = +d.petal_length; d.petal_width = +d.petal_width; return d; } d3.csv("iris.csv", type, function (data){ d3.select("#chart") .datum(data) .call(scatterPlot); });