PacktLib: matplotlib Plotting Cookbook

matplotlib Plotting Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

First Steps

Introduction

Installing matplotlib

Plotting one curve

Using NumPy

Plotting multiple curves

Plotting curves from file data

Plotting points

Plotting bar charts

Plotting multiple bar charts

Plotting stacked bar charts

Plotting back-to-back bar charts

Plotting pie charts

Plotting histograms

Plotting boxplots

Plotting triangulations

Customizing the Color and Styles

Introduction

Defining your own colors

Using custom colors for scatter plots

Using custom colors for bar charts

Using custom colors for pie charts

Using custom colors for boxplots

Using colormaps for scatter plots

Using colormaps for bar charts

Controlling a line pattern and thickness

Controlling a fill pattern

Controlling a marker's style

Controlling a marker's size

Creating your own markers

Getting more control over markers

Creating your own color scheme

Working with Annotations

Introduction

Adding a title

Using LaTeX-style notations

Adding a label to each axis

Adding text

Adding arrows

Adding a legend

Adding a grid

Adding lines

Adding shapes

Controlling tick spacing

Controlling tick labeling

Working with Figures

Introduction

Compositing multiple figures

Scaling both the axes equally

Setting an axis range

Setting the aspect ratio

Inserting subfigures

Using a logarithmic scale

Using polar coordinates

Working with a File Output

Introduction

Generating a PNG picture file

Handling transparency

Controlling the output resolution

Generating PDF or SVG documents

Handling multiple-page PDF documents

Working with Maps

Introduction

Visualizing the content of a 2D array

Adding a colormap legend to a figure

Visualizing nonuniform 2D data

Visualizing a 2D scalar field

Visualizing contour lines

Visualizing a 2D vector field

Visualizing the streamlines of a 2D vector field

Working with 3D Figures

Introduction

Creating 3D scatter plots

Creating 3D curve plots

Plotting a scalar field in 3D

Plotting a parametric 3D surface

Embedding 2D figures in a 3D figure

Creating a 3D bar plot

User Interface

Introduction

Making a user-controllable plot

Integrating a plot to a Tkinter user interface

Integrating a plot to a wxWidgets user interface

Integrating a plot to a GTK user interface

Integrating a plot in a Pyglet application

Index