Wednesday, 3 January 2018

Data Visualization: BarChart - using Matplotlib

A Bar Chart is used when we want to show how some quantity varies among some discrete set of items. It also helps to explore how the values are distributed. For example, How many centuries were scored by a player in a cricket tournament.

player = ['Sachin', 'Sehwag' , 'Dhoni', 'Virat', 'Dravid']
num_of_century = [7, 2, 3, 4, 5]

Below is a demonstration in python to generate a Bar chart using matplotlib in python.



Some very nice examples of Bar charts are available here

Data Visualisation - A Simple Example

Visualising data is one of the most import and powerful aspect of data science. It helps us with two things, one to explore the data and second to communicate the data to other people. It simply has a story to tell with the chart.

There are a lot of tools for visualising data like matplotlib library, tableau, d3.js etc.

Here is a basic example of matplotlib using which I am going to compare my savings over a period of time.

I am going to do this in python. I will be needing two lists to represent my X and Y axis. Y axis will show time period in years and X axis will show savings in INR.

I will be using some library methods to add title and label and then finally generate the chart. The chart generated is a Line Chart which is used when we want to compare a specific value over a period of time.

Below is a simple example written in python to demonstrate a Line Chart.