Data Visualization in Python with Matplotlib and Pandas - Basic Matplotlib Customization

Basic Matplotlib Customization

David Landup
David Landup

A good portion of Matplotlib's popularity comes from its customizability. Naturally, everyone working with Matplotlib will benefit significantly from being aware of these options, even if they're not really being used all the time.

In this lesson, we'll use the knowledge we've gained so far, alternating between the MATLAB/PyPlot-style approach to plotting and the Object-Oriented-style, and customize plots in a panoply of ways.

We'll explore common operations, such as changing the figure and font size, rotating text to make it fit better, saving images, setting axis ranges, adding multiple different-sized subplots, changing tick frequency, changing plot backgrounds, changing scales, but also dive into understanding Matplotlib Text.

There's an abundance of options to tweak and change with Matplotlib. In this lesson, we'll focus on the ones you'll frequently be using. In Lesson 7. - Advanced Matplotlib Customization, we'll focus on some of the less frequently used options, which are very useful and important nonetheless, such as understanding Matplotlib Stylesheets, Matplotlib Colors and Colormaps, and the GridSpec.

Since we've had an issue of fitting the four Axes objects in the last lesson, let's start off with changing the figure size.

Changing the Figure Size

Let's re-create the plot from the previous lesson, that couldn't fit very well into our Figure:

Start course to continue
Lessson 5/10
You must first start the course before tracking progress.
Mark completed

© 2013-2022 Stack Abuse. All rights reserved.