Introduction

In my previous** post**, I introduced some simple visualization tips to quickly build good-looking charts with Seaborn and Matplotlib. Today, I’m gonna show you in detail how to build more complex charts, including combination charts and subplots.

Necessary Package Installation

There are some packages that we should import first.

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline

Data Description

My dataset is collected from Kaggle public dataset and you can easily download via the following link:

Let’s take a look at our dataset. I will use data related to Germany as an example.

Data Visualization

Combination chart

This type of chart demonstrates multiple variables in different formats on the same chart. Combination chart can be helpful when you want to make comparisons between values in different categories.

As an example, let’s visualize the top 10 product categories in Germany by sales and their corresponding revenues.

In the above chart, the top 10 categories are displayed through bar chart and their revenues are displayed through line chart. By looking at this combination graph, we can observe some interesting insights.

  • The most purchased product is not the one that generates the most revenue. Take product 22326 for instance, its unit sold ranks first but its revenue only ranks third.
  • Although POST is the 3rd most purchased item, it’s the product that generates the most revenue.
  • 22961 is the least purchased product, but its revenue ranks 6th.

Subplots

Subplot helps create multiple plots on a single panel. In this section, I will show you a few ways to make a beautiful graph with multiple plots.

Again, we are using the top 10 product categories in Germany by sales.

Let’s try to combine 4 plots into a figure.

I’m gonna plot:

  • Top 10 consumers by product units purchased
  • Top 10 consumers by amount of money paid
  • Top 10 product categories that Top 10 consumers purchase, by units
  • Top 10 product categories that Top 10 consumers pay most money for

#data-visualization #visualization #data-analysis

Data Visualization Cheat Sheet with Seaborn and Matplotlib (Part 2)
1.95 GEEK