Data Visualization with Python
Matplotlib is a mathematical plotting library for Python that provides a variety of different plotting functionality.
Matplotlib provides two distinct methods for plotting, though they are interchangable for the most part:
- Firstly, matplotlib provides the
pyplotinterface, 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:
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 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)
Here is a sample plot created using MayaVI from the documentation.
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 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.