
Matplotlib 3.0 Cookbook
Over 150 recipes to create highly detailed interactive visualizations using Python
- 676 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Matplotlib 3.0 Cookbook
Over 150 recipes to create highly detailed interactive visualizations using Python
About this book
Build attractive, insightful, and powerful visualizations to gain quality insights from your data
Key Features
- Master Matplotlib for data visualization
- Customize basic plots to make and deploy figures in cloud environments
- Explore recipes to design various data visualizations from simple bar charts to advanced 3D plots
Book Description
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.
What you will learn
- Develop simple to advanced data visualizations in Matplotlib
- Use the pyplot API to quickly develop and deploy different plots
- Use object-oriented APIs for maximum flexibility with the customization of figures
- Develop interactive plots with animation and widgets
- Use maps for geographical plotting
- Enrich your visualizations using embedded texts and mathematical expressions
- Embed Matplotlib plots into other GUIs used for developing applications
- Use toolkits such as axisartist, axes_grid1, and cartopy to extend the base functionality of Matplotlib
Who this book is for
The Matplotlib 3.0 Cookbook is for you if you are a data analyst, data scientist, or Python developer looking for quick recipes for a multitude of visualizations. This book is also for those who want to build variations of interactive visualizations.
Tools to learn more effectively

Saving Books

Keyword Search

Annotating Text

Listen to it instead
Information
Exploratory Data Analysis Using the Seaborn Toolkit
- Relational plots (sns.relplot):
- Line plots (sns.lineplot)
- Scatter plots (sns.scatterplot)
- Categorical plots (sns.catplot):
- Strip and swarm plots (sns.stripplot, sns.swarmplot)
- Box and boxn plots (sns.boxplot, sns.boxnplot)
- Bar and count plots (sns.barplot, sns.countplot)
- Violin plots (sns.violinplot)
- Point plots (sns.pointplot)
- Distribution plots:
- Distribution, Kernel Density Estimate (KDE), and rug plots (sns.distplot, sns.kdeplot, sns.rugplot)
- Regression plots:
- Regression plots and residual plots (sns.regplot, sns.residplot)
- Lm plots (sns.lmplot)
- Multi-plot grids:
- Joint plots and joint grid plots (sns.jointplot, sns.JointGrid)
- Pair Plots and pair grid plots (sns.pairplot, sns.PairGrid)
- Facet grids (sns.FacetGrid)
- Matrix plots:
- Heatmaps (sns.heatmap)
- Cluster maps (sns.clustermap)
Introduction
Snacks Sales dataset


import pandas as pd
import numpy as np
snacks_sales = pd.read_csv('Snacks_Data.csv')
snacks_sales['Month'] = pd.DatetimeIndex(snacks_sales['Date']).month
Quarter_Mapping = {1:1, 2:1, 3:1, 4:2, 5:2, 6:2, 7:3, 8:3, 9:3, 10:4,
11:4, 12:4}
snacks_sales['Quarter'] = snacks_sales['Month'].map(Quarter_Mapping)
Wine Quality

import pandas as pd
# Read the data from a csv file into pandas data frame
wine_quality = pd.read_csv('winequality.csv', delimiter=';')
# Map numeric Quality codes to "Low", "Med" and "High" qualitative
ratings
quality_map = {3:'Low', 4: 'Low', 5:'Med', 6:'Med', 7:'High', 8:'High'}
wine_quality['Quality'] = wine_quality['quality'].map(quality_map)
# compute correlation matrix
corr = wine_quality.corr()
# Display the first 5 records of wine_quality dataset, and unique
values of quality variable
wine_quality.head()
set(wine_quality.quality)
Semantic and facet variables
Table of contents
- Title Page
- Copyright and Credits
- Packt Upsell
- Contributors
- Preface
- Anatomy of Matplotlib
- Getting Started with Basic Plots
- Plotting Multiple Charts, Subplots, and Figures
- Developing Visualizations for Publishing Quality
- Plotting with Object-Oriented API
- Plotting with Advanced Features
- Embedding Text and Expressions
- Saving the Figure in Different Formats
- Developing Interactive Plots
- Embedding Plots in a Graphical User Interface
- Plotting 3D Graphs Using the mplot3d Toolkit
- Using the axisartist Toolkit
- Using the axes_grid1 Toolkit
- Plotting Geographical Maps Using Cartopy Toolkit
- Exploratory Data Analysis Using the Seaborn Toolkit
- Other Books You May Enjoy
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app