Book Image

Clojure Data Analysis Cookbook - Second Edition

By : Eric Richard Rochester
Book Image

Clojure Data Analysis Cookbook - Second Edition

By: Eric Richard Rochester

Overview of this book

Table of Contents (19 chapters)
Clojure Data Analysis Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating scatter plots with NVD3


If you've been following along from the previous recipes in this chapter, you'll now have a complete web application stack ready, and you can use it to create charts and graphs for the Web.

For this recipe, we'll create a scatter plot of the US census racial data that we saw in Chapter 6, Workin with Incanter DataSets, in the Grouping data with $group-by recipe. In fact, this will be the same recipe as we saw in Chapter 10, Working with Unstructured and Textual Data, only this time we'll create a web page.

To do this, we'll use the D3 JavaScript library (http://d3js.org/). D3 stands for Data-Driven Documents, and this library makes it easy to load data and create HTML and SVG structures from data. You can use it to transform data into tables or charts. It is pretty low-level though. With D3, we will create many of the actual elements. We'll do this in a later recipe, but for now, we'll use the NVD3 library (http://nvd3.org/), which is a collection of prebuilt...