Book Image

Matplotlib 3.0 Cookbook

By : Srinivasa Rao Poladi, Nikhil Borkar
Book Image

Matplotlib 3.0 Cookbook

By: Srinivasa Rao Poladi, Nikhil Borkar

Overview of this book

Matplotlib provides a large library of customizable plots, along with a comprehensive set of backends. Matplotlib 3.0 Cookbook is your hands-on guide to exploring the world of Matplotlib, and covers the most effective plotting packages for Python 3.7. With the help of this cookbook, you'll be able to tackle any problem you might come across while designing attractive, insightful data visualizations. With the help of over 150 recipes, you'll learn how to develop plots related to business intelligence, data science, and engineering disciplines with highly detailed visualizations. Once you've familiarized yourself with the fundamentals, you'll move on to developing professional dashboards with a wide variety of graphs and sophisticated grid layouts in 2D and 3D. You'll annotate and add rich text to the plots, enabling the creation of a business storyline. In addition to this, you'll learn how to save figures and animations in various formats for downstream deployment, followed by extending the functionality offered by various internal and third-party toolkits, such as axisartist, axes_grid, Cartopy, and Seaborn. By the end of this book, you'll be able to create high-quality customized plots and deploy them on the web and on supported GUI applications such as Tkinter, Qt 5, and wxPython by implementing real-world use cases and examples.
Table of Contents (17 chapters)

What this book covers

Chapter 1, Anatomy of Matplotlib, explains the architecture of Matplotlib, various elements of a figure, interactive and non-interactive modes of operation, and how to customize environmental parameters.

Chapter 2, Getting Started with Basic Plots, introduces many types of graph that are commonly used in business intelligence and machine learning applications, including line, scatter, bar, stacked, histogram, box, violin, contour plots, heatmaps, and Hinton diagrams.

Chapter 3, Plotting Multiple Graphs, Subplots, and Figures, shows how to organize graphs into subplots and figures.

Chapter 4, Developing Visualizations for Publishing Quality, illustrates how to customize various attributes of a figure, including color, fonts, labels, titles, legend, spines, styles, markers, and annotation.

Chapter 5, Plotting with the Object-Oriented API, introduces the object-oriented API and compares it with the pyplot API. The object-oriented API gives flexibility in designing complex dashboards as required, but requires Python programming experience if you want to write code. The pyplot API comes with pre-packaged graphs that require simple commands to plot, without needing to write much Python code.

Chapter 6, Plotting with Advanced Features, covers how to develop complex visualization applications by using the advanced customization of legends, artist, and layout, as well as cycling object properties, origin and extent in images, transforms, animations, event handling, and path effects.

Chapter 7, Embedding Text and Expressions, covers how to add text to plots with regular text, annotations and mathematical expressions.

Chapter 8, Saving the Figure in Different Formats, explains how to save figures to external output files in PNG, PDF, SVG, and PS formats.

Chapter 9, Developing Interactive Plots, explains how to develop interactive plots using event handling, animations, and widgets. These features enable the users to perform interactive analysis.

Chapter 10, Embedding Plots in Graphical User Interface, explains how to embed Matplotlib plots into other graphical user interfaces used for developing applications.

Chapter 11, Plotting 3D Graphs Using the mplot3d Toolkit, covers how to use the mplot3D toolkit to plot 3D graphs, and the next two chapters cover two more toolkits.

Chapter 12, Using the axisartist Toolkit, explains that while the standard Matplotlib axes uses a traditional Cartesian coordinate system, it can't handle special features such as curved or floating axes that are useful in plotting geographical or planetary systems. This chapter explains how to create special applications using the axisartist toolkit.

Chapter 13, Using the axes_grid1 Toolkit, covers the axes_grid1 toolkit. This toolkit enables you to plot images in a grid with an associated color bar that aligns well with the image and also enables anchor images as legends, zoom in/out effects, and more.

Chapter 14, Plotting Geographical Maps Using the Cartopy Toolkit, explains wide variety of features that cater to many different user communities. We will cover most of the features typically used in business applications.

Chapter 15, Exploratory Data Analysis Using the Seaborn Toolkit, explains the process of exploratory data analysis using exhaustive features of seaborn toolkit.