Skip to main content
100%

Spotify Dataset Basic Scatter Plot with React & D3

✓ Published2🌍 Public
JJose Morales
Last edited Sep 11, 2025
Created on Sep 11, 2025

This example shows a basic scatter plot of Spotify track data, mapping song duration in milliseconds along the x-axis against track popularity on the y-axis. Each circle represents one of 500 songs from a Kaggle dataset subset. Using React hooks to load the CSV file, the rendering delegates to a D3 function that applies `scaleLinear` and `extent` to compute the scales. The D3 `select` and `join` methods create the circle elements.

AI-generated description

Spotify Music Dataset

This dataset is a subset of the “Spotify Music Dataset” dataset available from Kaggle.

To create this subset, I simply took the first the 500 entries from the data full dataset, and removed some of the columns included. The following are included in this subset:

  • track_artist – The artist(s) performing the track (categorical attribute)
  • track_popularity – A score from 0–100 based on the track’s relative streaming frequency (quantitative sequential attribute)
  • track_album_name – The album in which the track is featured (categorical attribute)
  • playlist_name – The name of the playlist where the track is included (categorical attribute)
  • track_name – The name of the track (categorical attribute)
  • duration_ms – The length of the track in milliseconds (quantitative sequential attribute)
  • id – A unique identifier for the song (categorical attribute)
MIT Licensed

Similar vizzes