Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Scatter plot of Iris

Public visualization

Viewing a saved revision (read-only)

fbf36ed82e2b4f51b5c47b8a5c94e348

Scatter plot of Iris

0 stars1🌍 Public
Wweird_danger
Last edited Sep 13, 2024
Created on Sep 11, 2024

This interactive scatter plot visualizes the Iris flower dataset, showing measurements of sepal and petal length and width for three species. The visualization uses d3.select, d3.scaleLinear, d3.axisBottom, d3.axisLeft, and d3.scaleOrdinal to render circles colored by species (red for setosa, blue for versicolor, green for virginica) with an opacity of 0.3. Users can dynamically select which measurements to plot on the x and y axes via dropdown menus. The SVG rendering includes grid lines, labeled axes, and a title, with data loaded from a local CSV file.

AI-generated description

// // imported function axisLeft for namings // // maximum population number should map to maximum width of our svg // // mac is to compute maximum value where it takes 2 values = data and // // d 1 row of data, and returns population number max // // min and maximum value in our data for the width, first entry should be 0

// const xAxisTickFormat = (number) => // format('.3s')(number).replace('G', 'B'); // // // creating a function to customize big numbers wit G

// g.append('g').call(yAxis).selectAll('.domain').remove(); // // '' selector for string // // select elements we want to remove(to remove ticks/lines)

//   // The text-anchor attribute is used to align
//   // (start-, middle- or end-alignment) a string of pre-formatted text
//   // or auto-wrapped text where the wrapping area
//   // is determined from the inline-size property relative to a given point.

csv('http://vis.lab.djosix.com:2024/data/iris.csv').then( (data) => { data.forEach((d) => { d.sepalLength = +parseFloat(d['sepal length']); d.sepalWidth = +parseFloat(d['sepal width']); d.petalLength = +parseFloat(d['petal length']); d.petalWidth = +parseFloat(d['petal width']); }); render(data); }, )