Fork of Basic Scatter Plot with React & D3
This fork of a React & D3 scatter plot displays the classic Iris dataset, plotting petal length against petal width for all three species as a single series of burnt-orange circles on a cream background. Built with React 19 and D3 v7, the visualization uses `d3.csv` to load data, `d3.scaleLinear`, `d3.extent`, and `d3.axisBottom`/`axisLeft` to construct scales and axes, with charcoal-gray styling applied throughout.
AI-generated descriptionReact + D3 Iris Petal Scatter Plot
This project is a simple starter for data visualization using React (via CDN ESM imports) and D3.js, displayed as a scatter plot of Iris flower petal lengths vs petal widths. The dataset used is a subset of the classic Iris dataset.
Features
- React 19 (from CDN, no build step)
- D3.js v7 (from CDN)
- Visualization is created by D3 within a React component
- Data loaded from
data.csv
How to Use
Clone or Download this repository.
Open
index.htmldirectly in your browser (no build tools required).
ℹ️ All dependencies are loaded via CDN ESM imports, so you only need a modern browser.
- The scatter plot will appear:
- X axis: Petal Length
- Y axis: Petal Width
Project Structure
index.html: The main HTML file. Loads the React app.index.js: Bootstraps the React app.App.js: Main React component. Loads data and renders the SVG.viz.js: Contains the D3 code that creates the visualization.data.csv: Iris flower data (only the first species).README.md: Project documentation (this file).
Customization
- To use a different dataset, replace
data.csvwith your own in the same format. - To change the fields plotted, edit the
xValueandyValueinApp.jsand axis labels inviz.js.
License
MIT or public domain