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 2. Figure Aesthetics

Now that you have entered the world of Matplotlib, surely you will want more than plain boring figures that look all the same. This chapter talks about the aesthetics of a figure. We introduce the structure and components of a Matplotlib figure and how to style these details. In this chapter, you will learn how to make a figure stylish, professional, and genuinely yours.

Here are the topics covered in this chapter:

  • Basic structure and terminologies of a Matplotlib figure
  • Setting colors in Matplotlib
  • Adjusting text formats
  • Lines and markers
    • Customizing line styles
    • Customizing marker styles
  • Grids, ticks, and axes
    • Adding and adjusting grid lines
    • Adjusting tick spacing
    • Customizing tick formatters
    • Adding axes labeling
    • Nonlinear axes
  • Title and legends
  • Style sheet support