Chapter 3. Drawing Your First Plots and Customizing Them

In this chapter, we will go into a lot more detail and present most of the possibilities of matplotlib. We will cover the following points:

  • Defining plot types – bar, line, and stacked charts
  • Drawing simple sine and cosine plots
  • Defining axis lengths and limits
  • Defining plot line styles, properties, and format strings
  • Setting ticks, labels, and grids
  • Adding legends and annotations
  • Moving spines to the center
  • Making histograms
  • Making bar charts with error bars
  • Making pie charts count
  • Plotting with filled areas
  • Making stacked plots
  • Drawing scatter plots with colored markers

Introduction

Although we have already drawn our first plots using matplotlib, we didn't go into the details about how they work, how to set them up, or what the possibilities with using matplotlib are. We explore and exercise most common types of data visualizations: line graphs, bar charts, histograms, pies, and variations thereof.

matplotlib is a powerful toolbox that satisfies almost all our needs for 2D and some 3D plotting needs as well. The best way the authors intend for you to learn matplotlib is through examples. When we need to draw a plot, we look for a similar example and try to change it to fit our needs. In this way, we are also going to present you with some useful examples and believe that this example will help you find a plot most similar to what you need.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.188.201