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.
What we are going to learn 3D plots Live graphs Sub plots Geographic plotting on maps
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
3D Plots
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
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
Azimuthal Equidistant Projection
Miller Cylindrical Projection
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.
Representation of subplot in the form of grid 2X1
Representation of subplot in the form of grid 2X2
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
Any Questions?