# Visual Analytics Course

scatterplots

## Visual Analytics Course

### Scatterplots

Scatterplots are basic graphical devices. They are nonetheless extremely relevant, useful and well understood. We shall be looking at 2D scatterplots here (one could consider 3D scatterlots as well.) Scatterplots (or point clouds) are defined as a collection of 2D points mapped onto the plane (it's easy, isn't it?). Scatterplots help to see whether there are any correlation in the data.

The 2D point cloud on the right is a scatterplot built from the Cars dataset (from Ward et al. book). Cars come with attributes indicating their fuel consumption in city or on highways. As you can see the diagram aligns: there is a clear match between those two attributes. A clear conclusion pops up: cars that have low fuel consumption in city also have a low consumption on highways, and vice-versa.

Now what about the price dealers ask for these cars? Is there a match between fuel consumption and car price? Just how much do dealers make this a main feature when selling cars. Have a look at the scatterplot on the left. Well, there is no clear correlation between those two features, which does not mean that the price does not depend on fuel consumption – looking closely at the data we see that indeed high prices cars indeed behave rather well on fuel consumption. But given a fuel consumption value, it seems you can find cars that quite vary in price. So there must be other features that determine the dealer price of a car …

Building a scatterplot is straightforward: take any two attributes , in your dataset, and turn them into and coordinates in the plane. There you go. Now, these and attributes are often seen as random variables observed on a sample (your dataset). A classical question one asks is whether these two variables tell the same thing about the dataset (the sample) or not. If grows proportionally with , then you don't learn much from that you can't learn from . In this case, we say that and correlate. Well, it may be that partly behaves as if it was linearly correlated with (note: it may also be a side effect of the sample).

The Pearson correlation coefficient precisely measures just how much correlation there is between two sampled random variables. Denote as and the values for and associated with data elements . The Pearson correlation coefficient is defined as:

Animated scatterplots

Scatterplots are simple visual devices, but they are well understood even by a non specialist crowd. Hans Rosling from GapMinder uses animated scatterplots to entertain and discuss quite serious and controversial questions. His talks simply are fascinating. Go to youtube and search for his TED talks, any subject is worth listening to; babies and religions, life expectancy and fertility, etc.