How it works...

Here is the explanation of the code.

This is the first plot:

  • g = sns.jointplot() plots the required joint plot of the three graphs.
  • kind='reg' specifies to plot a regression plot.
  • marginal_kws=dict(bins=15, fit=norm, rug=True, color='darkblue') is the dictionary of parameters to be applied to the marginal axes graphs. They are applicable to both the top and right marginal axes, but not related to joint plot objects:
    • bins=15 is the number of bins for the histogram to be plotted; by default, a histogram is plotted.
    • fit=norm specifies to fit a normal distribution curve for the given data.
    • rug=True, plots the rug plot for the given data.
    • color='darkblue' is the color to be used for all the elements of both marginal axes.
    • space=0.1 ...

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.