Multi-plot example – scatterplot matrix plots

In this section, we will learn how to have several plots in the same figure.

The key new method that allows multiple plots in the same figure is fig.subplot(nrows, ncols, plotIndex). This method, an overloaded version of the fig.subplot method we have been using up to now, both sets the number of rows and columns in the figure and returns a specific subplot. It takes three arguments:

  • nrows: The number of rows of subplots in the figure
  • ncols: The number of columns of subplots in the figure
  • plotIndex: The index of the plot to return

Users familiar with MATLAB or matplotlib will note that the .subplot method is identical to the eponymous methods in these frameworks. This might seem a little complex, so let's ...

Get Scala: Guide for Data Science Professionals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.