# Data Visualization with Python

## Matplotlib

Matplotlib is a mathematical plotting library for Python that provides a variety of different plotting functionality.

**The matplotlib documentation can be found here, with the SO Docs being available here.**

Matplotlib provides two distinct methods for plotting, though they are interchangable for the most part:

- Firstly, matplotlib provides the
`pyplot`

interface, direct and simple-to-use interface that allows plotting of complex graphs in a MATLAB-like style. - Secondly, matplotlib allows the user to control the different aspects (axes, lines, ticks, etc) directly using an object-based system. This is more difficult but allows complete control over the entire plot.

Below is an example of using the `pyplot`

interface to plot some generated data:

Note that `plt.show()`

is known to be problematic in some environments due to running `matplotlib.pyplot`

in interactive mode, and if so, the blocking behaviour can be overridden explicitly by passing in an optional argument, `plt.show(block=True)`

, to alleviate the issue.

## MayaVI

MayaVI is a 3D visualization tool for scientific data. It uses the Visualization Tool Kit or VTK under the hood. Using the power of VTK, **MayaVI** is capable of producing a variety of 3-Dimensional plots and figures. It is available as a separate software application and also as a library. Similar to Matplotlib, this library provides an object oriented programming language interface to create plots without having to know about **VTK**.

**MayaVI is available only in Python 2.7x series! It is hoped to be available in Python 3-x series soon! (Although some success is noticed when using its dependencies in Python 3)**

Documentation can be found here. Some gallery examples are found here

Here is a sample plot created using **MayaVI** from the documentation.

## Plotly

Plotly is a modern platform for plotting and data visualization. Useful for producing a variety of plots, especially for data sciences, **Plotly** is available as a library for **Python**, **R**, **JavaScript**, **Julia** and, **MATLAB**. It can also be used as a web application with these languages.

Users can install plotly library and use it offline after user authentication. The installation of this library and offline authentication is given here. Also, the plots can be made in **Jupyter Notebooks** as well.

Usage of this library requires an account with username and password. This gives the workspace to save plots and data on the cloud.

The free version of the library has some slightly limited features and designed for making 250 plots per day. The paid version has all the features, unlimited plot downloads and more private data storage. For more details, one can visit the main page here.

For documentation and examples, one can go here

A sample plot from the documentation examples:

## Seaborn

Seaborn is a wrapper around Matplotlib that makes creating common statistical plots easy. The list of supported plots includes univariate and bivariate distribution plots, regression plots, and a number of methods for plotting categorical variables. The full list of plots Seaborn provides is in their API reference.

Creating graphs in Seaborn is as simple as calling the appropriate graphing function. Here is an example of creating a histogram, kernel density estimation, and rug plot for randomly generated data.

The style of the plot can also be controled using a declarative syntax.

As an added bonus, normal matplotlib commands can still be applied to Seaborn plots. Here's an example of adding axis titles to our previously created histogram.