Skip to main content
100%

Animate Dynamic D3 scatterplot

✓ Published1🌍 Public
BBart van Pelt
Last edited Jan 20, 2023
Created on Jan 20, 2023

This example animates a dynamic scatterplot of the classic Iris flower dataset, cycling through different x-axis attributes every three seconds. The visualization uses D3 v7 with an SVG rendering approach, where circles represent data points and smoothly transition their positions and opacity using the `selection.join()` pattern for enter, update, and exit states. Axes update in sync using `axisBottom` and `axisLeft`, while all animations are coordinated through D3's `transition()` with a three-second duration. The code relies on `scaleLinear` and `extent` to map data values to pixel coordinates within the specified margins.

AI-generated description

Example Dynamic scatterplot

https://www.youtube.com/watch?v=xkBheRZTkaw To 14:21

https://youtu.be/U8x862hBk4s

Reference

Documentation on animation form new/changed objects: https://observablehq.com/@d3/selection-join

In example there are cases for

  • enter new objects
  • update existing objects
  • exit removed objects
MIT Licensed

Similar vizzes