Book Image

matplotlib Plotting Cookbook

By : Alexandre Devert
Book Image

matplotlib Plotting Cookbook

By: Alexandre Devert

Overview of this book

Table of Contents (15 chapters)
matplotlib Plotting Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Controlling a marker's style


In Chapter 1, First Steps, we have seen how we can display the points of a curve as dots. Also, scatter plots represent each point of a dataset. As it turns out, matplotlib offers a variety of shapes to replace dots with other kinds of markers. In this recipe, we are going to see how to set a marker's style.

Getting ready

Markers can be specified in various ways as follows:

  • Predefined markers: They can be predefined shapes, represented as a number in the [0, 8] range, or some strings

  • Vertices list: This is a list of value pairs, used as coordinates for the path of a shape

  • Regular polygon: It represents a triplet (N, 0, angle) for an N sided regular polygon, with a rotation of angle degrees

  • Start polygon: It represents a triplet (N, 1, angle) for an N sided regular star, with a rotation of angle degrees

How to do it...

Let's take a script that shows two sets of points with two different colors. Now we will display all the points in black, but with different markers as...