Skip to main content
100%

Fork of Scatter Plot with Missing Data

✓ Published1🌍 Public
Ttejasreddy214@gmail.com
Last edited Apr 26, 2024
Created on Apr 26, 2024

This example shows a scatter plot of penguin measurements, plotting bill length against flipper length. Missing data is filtered out before rendering so that only complete observations are drawn as semi-transparent circles. The code uses D3’s `select` and `scaleLinear`, along with `Array.filter` and `isNaN` to remove rows with undefined values. The chart includes axes, labels, and a gray inner rectangle, with data sourced from the `@curran/penguins` dataset.

AI-generated description

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

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

Similar vizzes