More Advanced MatPlotLib Styling

So, going more into depth with MatPlotLib is all about learning how to style your graphs according to how you’d like them. I’ll document some more techniques that I’ve learned here. Creating a secondary axis Sometimes, you need to overlay graphs. In my specific case, I needed a graph that showed both Value and Amount. My left y-axis would be the Value, whilst my right y-axis would be Amount. It looks like this ...

December 20, 2021 · 2 min · Lei

MatPlotLib Basics

Basics of Matplotlib In this tutorial, I’ll be going through the basics of using MatPlotLib. We’ll learn some of the building blocks of MPL: Figures, Artists, Axes, Axis. Importing 1 2 3 import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np Figures The main primitive of MPL is a figure. A figure is an object class that contains a lot of methods that we can use to plot figures. In the words of MPL, a figure is a ’top level Artist’ that holds all plot elements. What is an artist?? I hear you say. ...

December 20, 2021 · 8 min · Lei