Getting started with matplotlib
For many data scientists, the vast majority of their plotting commands will use pandas or seaborn, both rely on matplotlib to do the plotting. However, neither pandas nor seaborn offers a complete replacement for matplotlib, and occasionally you will need to use matplotlib. For this reason, this recipe will offer a short introduction to the most crucial aspects of matplotlib.
One thing to be aware if you are a Jupyter user. You will want to include the:
>>> %matplotlib inline
directive in your notebook. This tells matplotlib to render plots in the notebook.
Let's begin our introduction with a look at the anatomy of a matplotlib plot in the following figure:
Matplotlib hierarchy
Matplotlib uses a hierarchy of objects to display all of its plotting items in the output. This hierarchy is key to understanding everything about matplotlib. Note that these terms are referring to matplotlib and not pandas objects...