How it works...

Here is the explanation of the preceding code. This is the first plot:

  • catplot() with kind='bar' does not give the flexibility to capture individual bars to be able to plot the value on top of each of the bars. Hence, for the first plot, we use barplot(), which is similar to the Matplotlib bar chart
  • b = sns.barplot(x='Item', y='Sales', data=long_sales, estimator=sum, palette='husl') plots the bar plot:
    • estimator=sum specifies that instead of the default average value, plot the sum of all observations for a given item
    • palette='husl' specifies the color palette to be used
  • b.set(yscale='log', ylim=[50000, 1000000]) sets up the logarithmic scale on the y axis and sets the limits as provided
  • sns.despine() makes the top and ...

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.