How it works...

Here is the explanation for the preceding code:

This is the first plot:

  • g = sns.PairGrid(snacks_sales_items, hue='Promotion', hue_kws={"marker": ["^", "D"]},palette={'Yes': 'blue', 'No': '#00a99f05'}) creates the grid for all the variables in the dataset:
    • hue_kws={"marker": ["^", "D"]} specifies the markers to be used for Yes and No values of the hue variable Promotion
    • palette={'Yes': 'blue', 'No': '#00a99f05'} specifies the color codes to be used for the hue variable unique values
  •, edgecolor='k', s=50) plots scatter plot on each of the plots on the grid:
    • edgecolor='k' specifies black for the edges of points on the scatter plot.
    • s=50 specifies the size of the points/markers on the scatter plot.
  • g.add_legend() ...

Get Matplotlib 3.0 Cookbook now with the O’Reilly learning platform.

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