How it works...

Here is the explanation of the code:

This is the first plot:

  • g1 = sns.JointGrid() sets up the grid:
    • space=0.1 is the amount of gap between the joint plot and marginal plots.
    • height=6 is the height of the plot in inches.
    • ratio=2 is the ratio of joint plot height and marginal plot height.
  • g1 = g.plot(sns.regplot, sns.kdeplot) specifies the type of plot for the joint plot and both of the marginal plots. Other compatible plots such as plt.scatter and sns.distplot can also be used, instead of sns.regplot and sns.kdeplot.
  • g.plot() does not give any flexibility to supply various parameters, it just uses all default parameters of the supplied plot types. However, axes-level customization is possible, as follows:
    • g1.ax_joint.set_xlabel('Coffee', ...

Get Matplotlib 3.0 Cookbook 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.