More advanced scatter plots

Breeze-viz offers a scatter function that adds a significant degree of customization to scatter plots. In particular, we can use the size and color of the marker points to add additional dimensions of information to the plot.

The scatter function takes, as its first two arguments, collections of x and y points. The third argument is a function mapping an integer i to a Double indicating the size of the ith point. The size of the point is measured in units of the x axis. If you have the sizes as a Scala collection or a Breeze vector, you can use that collection's apply method as the function. Let's see how this works in practice.

As with the previous examples, we will use the REPL, but you can find a sample program in ...

Get Scala for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.