Published on Feb 22,2017
1.5K Views
Email Post

Matplotlib is a plotting library in Python, which produces 2D graphics in different interactive environments. In Matplotlib, you can draw different types of graphs, like line, scattered, bar, etc. It is mostly used in Python and R for drawing graphs and enabling exploration of data. Following are the features of Matplotlib:

  • It has a large community.
  • It comprises of tons of plot types.
  • It is well integrated into ipython.
  • It is the de-facto standard for ‘command line’ plotting from ipython.
  • It enables day-to-day data exploration.

The different types of plots it supports with are:

  1. Line Plots
  2. Scatter Plots
  3. Bar Plots
  4. Histogram
  5. Multiple Plots

Following are two sample programs for Line and Scatter Plots:

Line Plots

>>> from pylab import * # for plotting commands

>>> x = arrange(50)*2*pi/50

>>> y = sin(x)

>>> plot(y)

>>> xlabel(‘index’)

>>> show()

Scatter Plot

>>> x = arrange(50)*2*pi/50

>>>y = sin(x)

>>> scatter(x,y)

>>>show()

Got a question for us? Mention them in the comments section and we will get back to you. 

Related Posts

Python for Data Science

Introduction to Python IDE

3 Compelling reasons to Choose Python

Learn Python for Big Data Analytics

About Author
edureka
Published on Feb 22,2017

Share on

Browse Categories

Comments
0 Comments