Scatter Plot
This example visualizes nuclear bomb test counts from 1945 to 2009, with each circle representing a country’s annual total. The x-axis shows the year, the y-axis shows bomb counts, and colors distinguish six countries, sourced from Johnston’s Archive via a processed CSV. Built with D3 v4, it uses `d3.scaleTime`, `d3.scaleLinear`, and `d3.scaleOrdinal` for scales, plus `d3.legendColor` from d3-legend for the color legend. Interactive features include hover tooltips displaying exact counts, while the SVG rendering updates responsively on window resize.
AI-generated descriptionPart of the video course: D3.js in Motion.
An example scatter plot with color legend using D3 and d3-legend.
This scatter plot shows the dataset of nuclear bomb test history. Originally published at Johnston's Archive - Nuclear Weapons, this small dataset records every nuclear bomb tests from 1945 to 2009. The original dataset have 6 countries' each year nuclear test. The raw data is not well organized in CSV format. So I use Python with Pandas to parse it into a proper format. Each row of the table represents an country's nuclear bomb test counts for that year.
In this scatter plot, Y axis is the count of the nuclear bomb test and X axis is representing year. Each circle is represent that year's total test for one country. Each country has different color and hover on the circle will display the actual count number for the nuclear test.
forked from <a href='http://bl.ocks.org/curran/'>curran</a>'s block: <a href='http://bl.ocks.org/curran/ecb09f2605c7fbbadf0eeb75da5f0a6b'>Stylized Scatter Plot with Color Legend</a>
forked from <a href='http://bl.ocks.org/YouthBread/'>YouthBread</a>'s block: <a href='http://bl.ocks.org/YouthBread/6b406e4d96f23ce64c1f7cb745b0722a'>Scatter Plot</a>
forked from <a href='http://bl.ocks.org/YouthBread/'>YouthBread</a>'s block: <a href='http://bl.ocks.org/YouthBread/cce54e06cbcd77f8c782fa060731e865'>Scatter Plot</a>