Exploring matplotlib
Matplotlib is one of the most frequently used Python libraries. It can generate plotting diagrams with great flexibility. The pandas plot()
function is a wrapper on top of matplotlib with some bare minimum functionality. While it does simplify the syntax, it also restrains the numerous possibilities of matplotlib. If you want to build complex visualizations, then matplotlib will be your best choice, as it allows controls over all kinds of properties, such as the size, the type of figures and markers, the line width, the colors, and the styles. We will see some of the customizations that can be easily done with matplotlib compared to pandas:
- Let's start with an example. Consider the following snippet:
# Importing libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt # Defining a DataFrame data_frame = pd.DataFrame({ 'Year':['2010','2011','2012','2013','2014',&apos...