🌍 Public
Viewing a saved revision (read-only)
4a2f896ec7214cc6820605053b0b1705
Scatter Plot with Missing Data
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))),
);