O'Reilly logo

Scala for Data Science by Pascal Bugnion

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required