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 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.