Skip to main content
100%

Reusable Scatterplot Example

✓ Published0🌍 Public
CCurran Kelleher
Last edited Sep 26, 2015
Created on Aug 8, 2015

This example demonstrates a reusable scatter plot built with D3.js, visualizing the classic Iris dataset. The chart renders as an SVG and plots sepal length against sepal width, with each of the 150 flowers represented by a circle. The visualization includes styled axes with custom fonts, and the code is structured as a reusable chart function that accepts data and accessor functions for x and y values, following the principles of the "Towards Reusable Charts" pattern. The design highlights flexibility in mapping data columns to visual channels while maintaining a clean, minimal aesthetic with a border around the SVG and Poiret One typography for axis labels.

AI-generated description

A reusable D3 scatter plot, constructed using Towards Reusable Charts and Standalone Scatter Plot as inspiration.

In the original reusable charts example, the comments state

// Convert data to standard representation greedily;
// this is needed for nondeterministic accessors.

In this adaptation, a simplifying assumption was made that no nondeterministic accessors will be given. Going one step further, an assumption was made that accessors will only want to access specific "columns" of data, meaning properties on each row object.

<!-- Start of SimpleHitCounter Code --> <div align="center"><a href="http://www.simplehitcounter.com" target="_blank"><img src="http://simplehitcounter.com/hit.php?uid=1956316&f=16777215&b=0" border="0" height="18" width="83" alt="web counter"></a></div> <!-- End of SimpleHitCounter Code -->

Similar vizzes