How it works...

Here is the explanation for the preceding code:

This is the first plot:

  • sns.distplot(snacks_sales.Coffee, color='g', rug=True, rug_kws={"color": 'm', "height": 0.1}) plots. This is the required distribution plot.
  • snacks_sales.Coffee is the coffee sales data whose distribution is to be plotted.
  • color='g' specifies that the color of the histogram and KDE plots that are plotted by default is green.
  • If you want to switch off the histogram or KDE plot, then pass the arguments hist=False and kde=False.
  • rug=True specifies whether the rug plot should be plotted on this distribution plot. The default option is False, hence it is not plotted.
  • rug_kws={"color": 'm', "height": 0.1} is the keyword dictionary to be used to format the rug ...

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.