Skip to main content
100%

Fork of Scatter Plot with Missing Data

✓ Published0🌍 Public
Pprint("Ayush")
Last edited May 7, 2024
Created on May 7, 2024

This example demonstrates a scatter plot that visualizes football player statistics from the `@eschuman20/footballscorers` dataset, filtering data to the year 2018 and plotting Goals against Shots with points colored by league. The code leverages `Array.filter` and `isNaN` to remove incomplete records, ensuring only valid data points are rendered. It uses D3’s `scaleLinear` for axes, `axisLeft` for the y-axis, and custom axis-label utilities from `@curran/axis-labels`. The visualization includes a light inner rectangle fill, semi-transparent circles, and a color mapping for leagues such as La Liga, Serie A, Bundesliga, and Premier League.

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))),
);
MIT Licensed

Similar vizzes