Posts

Showing posts with the label Data Visualization

How to generate Bar Graph using Matplotlib Library

Image
Bar chart is a special type of graph in which numerical values of some data are represented by rectangular bars of equal widths among some discrete set of items to which it varies its length.  This type of charts has a discrete range of data which helps in providing visual representation of categorical data. In this tutorial post, we will discuss here about how to generate Bar plots and customize it using Matplotlib python library. And for that purpose, we will demonstrate example of plotting data of visitor’s population entering a museum during different years. For using Matplotlib library for plotting, you must first have to import Matplotlib library and use functions provided by this awesome library. Also, you will use inline magic function %matplotlib inline so that you may display resultant figure after every line of code In[1]: import matplotlib.pyplot as plt %matplotlib inline Now you will define data of populations and years with variable nam...

How to create Scatter Plot using Matplotlib Library

Image
Scatter plot is one of the commonly used plots which is also thought as cousin of line plot in data visualization or data science. In this tutorial post we will discuss about scatter plot about how to create it using Matplotlib library and customize different properties of this plot based on our needs in data visualization. In scatter plots, we represent points individually with circle, dot or any other shape instead of joining points by line segment as we mostly do in line plotting. Let’s demonstrate some examples about how to create scatter plots. For generating scatter plots, we must start with following code to use Matplotlib library by importing it in our Jupiter notebook. In[1]: import matplotlib.pyplot as plt import numpy as np % matplotlib inline After importing matplotlib.pyplot module and numpy library in notebook, you can now easily use functions provided from these libraries as shown below; In[2]: x=np.linspace( 0 , 10 , 40 ) # Defin...

Introduction to Matplotlib Library for Data Visualization

Image
Data Visualization is one of the most important tasks in data analysis to explore and communicate our data. It is so broad field that many books have been written so far by great publishers which you can find on book stores. In this article, we will try to introduce  Matplotlib  library which is widely used for data visualization in python as data science toolkit to create quality plots ready for publications. Matplotlib  is generally a two-dimensional (2D) MATLAB style plotting library of python, created by John D. Hunter in 2002. Since then, John D. Hunter also cooperated with Fernando Perez (Creator of IPython) and others to make IPython work with this Matplotlib library for scientific computing. This cross-platform supported library is built on NumPy library designed to work with SciPy stack library for scientific computations.  This library first commercially released on 2003 can be used in Python and IPython shells, Python scripts, Jupiter no...