Book Image

Mastering Matplotlib 2.x

By : Benjamin Walter Keller
Book Image

Mastering Matplotlib 2.x

By: Benjamin Walter Keller

Overview of this book

In this book, you’ll get hands-on with customizing your data plots with the help of Matplotlib. You’ll start with customizing plots, making a handful of special-purpose plots, and building 3D plots. You’ll explore non-trivial layouts, Pylab customization, and more about tile configuration. You’ll be able to add text, put lines in plots, and also handle polygons, shapes, and annotations. Non-Cartesian and vector plots are exciting to construct, and you’ll explore them further in this book. You’ll delve into niche plots and visualize ordinal and tabular data. In this book, you’ll be exploring 3D plotting, one of the best features when it comes to 3D data visualization, along with Jupyter Notebook, widgets, and creating movies for enhanced data representation. Geospatial plotting will also be explored. Finally, you’ll learn how to create interactive plots with the help of Jupyter. Learn expert techniques for effective data visualization using Matplotlib 3 and Python with our latest offering -- Matplotlib 3.0 Cookbook
Table of Contents (7 chapters)

Visualizing ordinal and tabular data

In this section, we will talk about tabular and ordinal data, where we don't have an x axis and y axis. We're going to take a look at the following topics:

  • Pie charts
  • Tables
  • How to customize the appearance of plots

Pie charts

Let's take a look at the fractions of gases that exist in our atmosphere. The following content shows the code and output for Nitrogen, which is 78 percent of our atmosphere, Oxygen, which is 21 percent, and Argon, which is 1 percent. Now, naturally, Nitrogen, Oxygen, and Argon are not exactly numerical values. Hence, we cannot really plot these things against each other in the standard way. This is where we can use a pie chart as a best practice to...