Book Image

Matplotlib 2.x By Example

By : Allen Yu, Claire Chung, Aldrin Yim
Book Image

Matplotlib 2.x By Example

By: Allen Yu, Claire Chung, Aldrin Yim

Overview of this book

Big data analytics are driving innovations in scientific research, digital marketing, policy-making and much more. Matplotlib offers simple but powerful plotting interface, versatile plot types and robust customization. Matplotlib 2.x By Example illustrates the methods and applications of various plot types through real world examples. It begins by giving readers the basic know-how on how to create and customize plots by Matplotlib. It further covers how to plot different types of economic data in the form of 2D and 3D graphs, which give insights from a deluge of data from public repositories, such as Quandl Finance. You will learn to visualize geographical data on maps and implement interactive charts. By the end of this book, you will become well versed with Matplotlib in your day-to-day work to perform advanced data visualization. This book will guide you to prepare high quality figures for manuscripts and presentations. You will learn to create intuitive info-graphics and reshaping your message crisply understandable.
Table of Contents (15 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Using style sheets


We have learned to set the style details step by step so far. The matplotlib.style module provides a handy way to apply a predefined global style to the whole figure. There are a number of built-in style sheets coming along the matplotlib package. You can call matplotlib.style.available to check them out:

The function returns a list of built-in style sheets, including classic, seaborn, and ggplot. Classic refers to the Matplotlib style before version 2.0. Seaborn is a popular package built on top of Matplotlib that offers some special plotting APIs and themes for generating aesthetically attractive statistical figures. In Matplotlib 2.0, we can easily work on the styling natively for simple plot types, without importing an extra module. Multiple style sheets for different purposes are available. The ggplot style emulates ggplot_, a popular plotting package in R that features vibrant colors on a gray data area with white lines.

Applying a style sheet

Using a style is as simple...