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

Chapter 4. Visualizing Online Data

At this point, we have already covered the basics of creating and customizing plots using Matplotlib. In this chapter, we begin the journey of understanding more advanced Matplotlib usage through examples in specialized topics.

When considering the visualization of a concept, the following important factors have to be considered carefully:

  • Source of the data
  • Filtering and data processing
  • Choosing the right plot type for the data:
    • Visualizing the trend of data:
      • Line chart, area chart, and stacked area chart
    • Visualizing univariate distribution:
      • Bar chart, histogram, and kernel density estimation
    • Visualizing bivariate distribution:
      • Scatter plot, KDE density chart, and hexbin chart
    • Visualizing categorical data:
      • Categorical scatter plot, box plot, swarm plot, violin plot
  • Adjusting figure aesthetics for effective storytelling

We will cover these topics via the use of demographic and financial data. First, we will discuss typical data formats when we fetch data from the...