Scatter Plot with Missing Data
✓ Published1🌍 Public
This scatter plot visualizes the relationship between bill length and flipper length in penguins, using data from the `@curran/penguins` dataset. It demonstrates how to handle missing data by filtering out rows where either measurement is `NaN`, using JavaScript’s `Array.filter` and `isNaN`. The filtered data is rendered as semi-transparent points via `d3.select`, `d3.scaleLinear`, and `d3.axisLeft` within a D3.js SVG, with axis labels positioned by the `@curran/axis-labels` helper.
AI-generated descriptionA demonstration of how to filter out missing data, leveraging Array.filter and isNaN.
const filteredData = data.filter(
(d) => !(isNaN(xValue(d)) || isNaN(yValue(d))),
);
MIT Licensed