Sruthi E R — Published On August 5, 2021
Beginner Data Exploration Data Visualization Python Structured Data

This article was published as a part of the Data Science Blogathon

 data visualization


Human beings are amongst the most creative species on this planet. From time immemorable art has taken diverse forms, beginning from palaeolithic cave paintings to modern art. For instance, Bhimbetka cave paintings gave so many insights into the life of people back then. The genesis of visual art lies back in the stone age.

Now being a part of the fourth revolution generation, who has witness art and creativity in diverse fields and forms, here comes various tools and programming languages to our rescue to solve complex business problems using the art of visualization.

Modern-day business uses various visualization techniques to understand data and get insights from it to make data-driven business decisions. Nowadays there are a lot of visualization tools available like Tableau, Power BI, Looker, Qlik sense and a lot more. In this topic, we will be covering various types of charts using Python.

The Necessity of Data Visualization

Data makes more sense and is easy to understand when it is presented in a simple and visualized format, as it is difficult for the human eye to decipher the pattern, trend and seasonality from the raw data. Hence data is visualized to understand how different parameters are behaving.

Various types of charts and their uses

 data visualization | various chart types

1. Bar and Column Charts

It’s one of the simplest graphs to understand how our quantitative field is performing across various categories. It is used for comparison.

Bar chart


From the above column chart, we can see that sales of technology are higher and office supplies are the least.

bar chart horizontal

The above-shown graph is a bar chart that shows that L categories perform better.

2. Scatter Plot and Bubble Chart

Scatter and bubble plots help us to understand how variables are spread across the range considered. It can be used to identify the patterns, the presence of outliers and the relationship between the two variables.

scatter plot

We can see that with the increase in discount profits are decreasing.

scatter plot |  data visualization

The above-shown graph is a bubble graph.

3. Line Graph

It is preferred when time-dependent data has to be presented. It is best suited to analyse the trend.

Line graph |  data visualization

From the above graph, we can see that sales are increasing over the months but there is a sudden dip in the month of July and sales are highest in November.

4. Histogram

A histogram is a frequency chart that records the number of occurrences of an entry in a data set. It is useful when you want to understand the distribution of a series.

Histogram |  data visualization

5. Box Plot

Box plots are effective in summarizing the spread of large data. They use percentile to divide the data range. This helps us to understand data point which falls below or above a chosen data point. It helps us to identify outliers in the data.

box plot |  data visualization

Box plot divides entire data into three categories

* Median value-it divides the data into two equal halves

* IQR – It ranges between 25th and 75th percentile values.

* Outliers – This data differ significantly and lie outside the whiskers.

sales across country |  data visualization

The circles in the above plot show the presence of outliers.

6.  Subplots

Sometimes it’s better to plot different plots in the same grid to understand and compare the data better.

subplots |  data visualization

Here you can see that in the single graph we were able to understand sales over a period of time in different regions.

7. Donut, Pie charts and stacked column charts

When we want to find the composition of data above-mentioned charts is the best.

donut chart


The above doughnut chart shows the sales composition of different product categories.

pie chart |  data visualization

The above pie chart shows the percentage of sales in different years.

stacked bar chart


The above-stacked column chart shows the sale of two products over different quarters.

8. Heatmaps

It is the most preferred chart when we want to check if any correlation between variables.

heatmaps |  data visualization

Here the positive value shows a positive correlation and the negative value shows a negative correlation. The colour indicates the intensity of correlation, the darker the colour higher the positive correlation and the lighter the colour higher the negative correlation.

Understanding visualization with  Python 

Python offers various libraries to understand the data graphically like Matplotlib and Seaborn etc. Let’s begin our journey into the world of visualisation.

Anubhav is a product based company selling different kinds of products. Let’s explore the data to find its sales over a period, which product category/sub-category makes the highest sales, the relation of profit with an increase in discount.

1. Let’s import the relevant libraries first.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings (‘ignore’)

2. Next step would be to load the data set

sales=pd.read_excel('Maven Supplies Raw.xlsx',skiprows=3)
dataset |  data visualization

3. Having the dataset with us, let us explore the data

# Check the number of rows and columns in the dataframe
(9994, 24)
# Check the column-wise info of the dataframe
data  info |  data visualization
# Check the summary for the numeric columns 
data describe

4. Now that we have a better understanding of the data available let’s visualize it to get a better understanding.

– First, explore the composition of categories with sales%.

plt.title("Sales% of different category")
plt.ylabel(" ");
piechart python |  data visualization

We can see that technology is performing better when compared to other categories.

– There is a lot of sub-category within the data lets see how different sub-category is performing.

Bar chart |  data visualization

We can see that sales of the phone are the highest followed by chairs and so on.

– Sales in different regions will be different. Let’s see

sales per region |  data visualization

Sales in the West region is high and the south region is the least.

– Now let’s see how regions are performing in terms of profit

profit per region

The South region which was performing worst in terms of sales is performing better when compared to the central region.

– Heatmaps give us a better understanding of how different variables are correlated with each other.

plt.figure(figsize = (10, 5))
heatmap data

It’s evident that discounts are having a negative correlation with profit.

– Let’s decipher how profit is affected by an increase in discounts.

sns.scatterplot(x = 'Discount', y='Profit', data = sales ,color='seagreen');
scatter plot discount and profit

We can see that with the increase in discount the profits are also decreasing.

– Sales are not constant, it either increases or decreases depending on various factors. Let’s see how sales are performing over different months.

line plot |

Like mentioned before its showing a pattern with the highest sales in the month of November and the lowest sales in the month of February.

– It’s not necessary that even if the sales are high profits will show a similar pattern. Let’s see how profits are changing over the period of time. This might be due to the sale of products with discounts as seen in the scatter plot.


we can see that profits are high during the month of September and lowest during the month of July.

– Sales might show an increasing or decreasing pattern with year


We can see that sales show a declining trend in the year 2016 while it’s growing in all the years.

From a dataset, we were able to understand phones made the major portion of sales and the highest sales and profits were contributed by the west region. Over a period of time sales increased but with the increase in discount, profits showed a declining trend. We saw that there were particular months which witnessed highest sales and profit.

Thus we can say that visualization speaks a lot, it will always have some story to tell which helps businesses to make data-driven decisions.


In this article, we talked about various kinds of graphs and their uses. We dealt with a data set to understand how to use Python libraries to visualize the data and make sense out of it. Thus we can say that through visualization, it’s easy to decipher a hidden pattern or a trend in data. With few examples, we saw that graphs help in comparison and most importantly it’s easy to understand.


Thanks for reading!!!

I hope you enjoyed reading the article and increased your knowledge about various types of graphs and their usage.

If I have not mentioned anything or if you want to share your thoughts, feel free to comment below in the comment section. 


About the author

Sruthi E R

I’m a Data Science enthusiast with an interest in data analysis and visualization, currently pursuing Post Graduation Certification in Data Science from IIIT-Bangalore. I come from a Civil Engineering background with 4 years of experience in the construction industry.

Feel free to contact me on Linkedin

The media shown in this article are not owned by Analytics Vidhya and are used at the Author’s discretion.

About the Author

Sruthi E R

Our Top Authors

Download Analytics Vidhya App for the Latest blog/Article

Leave a Reply Your email address will not be published. Required fields are marked *