Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Scatter Plot with Missing Data

Public visualization

Scatter Plot with Missing Data

0 stars6🌍 Public
CCurran Kelleher
Last edited May 2, 2024
Created on Jan 29, 2024

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 description

A demonstration of how to filter out missing data, leveraging Array.filter and isNaN.

const filteredData = data.filter(
  (d) => !(isNaN(xValue(d)) || isNaN(yValue(d))),
);

Comments

Sign in to join the discussion.

MIT Licensed