Matplotlib SANTHOSH Boggarapu.

14
Matplotlib SANTHOSH BOGGARAPU

description

Structure of Matplotlib Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib is the whole package; pylab is a module in matplotlib that gets installed alongside matplotlib; and matplotlib.pyplot is a module in matplotlib Pyplot provides the state-machine interface to the underlying plotting library in matplotlib. Pylab combines the pyplot functionality (for plotting) with the numpy functionality (for mathematics and for working with arrays) in a single namespace, making that namespace (or environment) even more MATLAB-like. For example, one can call the sin and cos functions just like you could in MATLAB, as well as having all the features of pyplot.

Transcript of Matplotlib SANTHOSH Boggarapu.

Page 1: Matplotlib SANTHOSH Boggarapu.

MatplotlibSANTHOSH BOGGARAPU

Page 2: Matplotlib SANTHOSH Boggarapu.

Structure of Matplotlib Matplotlib is a python 2D plotting library which produces publication

quality figures in a variety of hardcopy formats and interactive environments across platforms.

Matplotlib is the whole package; pylab is a module in matplotlib that gets installed alongside matplotlib; and matplotlib.pyplot is a module in matplotlib

Pyplot provides the state-machine interface to the underlying plotting library in matplotlib.

Pylab combines the pyplot functionality (for plotting) with the numpy functionality (for mathematics and for working with arrays) in a single namespace, making that namespace (or environment) even more MATLAB-like. For example, one can call the sin and cos functions just like you could in MATLAB, as well as having all the features of pyplot.

Page 3: Matplotlib SANTHOSH Boggarapu.

What we are going to learn 3D plots Live graphs Sub plots Geographic plotting on maps

Page 4: Matplotlib SANTHOSH Boggarapu.

3D plot

A three-dimensional graph is the graph of a function f(x, y) of two variables, or the graph of a relationship g(x, y, z) among three variables.

We can draw all kinds of 3D plots using matplotlib. Let’s draw a 3D scatter plot using matplotlib

Page 5: Matplotlib SANTHOSH Boggarapu.

3D Plots

Page 6: Matplotlib SANTHOSH Boggarapu.

Live Graphs

Applications of live graphs are enormous As a Data Scientist, we come across data in the real world where

the data keeps on changing A simple example is something like graphing live stock pricing

data or we may need to display the live sensor data Let’s see an example on this

Page 7: Matplotlib SANTHOSH Boggarapu.

Geographical plotting

This functionality helps to Plotting data to a latitude and longitude

We will be using Basemap which works along with matplotlib. Basemap works alongside Matplotlib to allow you to plot via

latitude and longitude coordinates. You can download the Basemap here: http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/

basemap-1.0.7/

Basemap provide 24 different map projections and info about each them with some sample code is present in the link below:

http://matplotlib.org/basemap/users/mapsetup.html

Page 8: Matplotlib SANTHOSH Boggarapu.

Azimuthal Equidistant Projection

Page 9: Matplotlib SANTHOSH Boggarapu.

Miller Cylindrical Projection

Page 10: Matplotlib SANTHOSH Boggarapu.

subplots

Subplot divides the current figure into rectangular panes that are numbered row wise.

Each pane contains an axes object. Subsequent plots are output to the current pane.

Page 11: Matplotlib SANTHOSH Boggarapu.

Representation of subplot in the form of grid 2X1

Page 12: Matplotlib SANTHOSH Boggarapu.

Representation of subplot in the form of grid 2X2

Page 13: Matplotlib SANTHOSH Boggarapu.

More Examples

You can find more types of plots with sample code at http://matplotlib.org/examples/index.html

The plots are categorized into various sections based on the functionality

Each category has a number of examples. You can find tutorials on matplotlib at http://pythonprogramming.net/matplotlib-python-3-basics-tutorial

Page 14: Matplotlib SANTHOSH Boggarapu.

Any Questions?