Advanced figures and graphics

In this section, we will show more advanced graphical features offered by Matplotlib that are related to images and maps. We will also take a look at a few other graphical libraries.

Image processing

A colored N x M image can be represented as an N x M x 3 NumPy array corresponding to three N x M matrices for the red, green, and blue channels. Image processing algorithms can then be implemented efficiently with NumPy and SciPy and visualized with Matplotlib. In addition, the PIL package (Python Imaging Library) implements basic image processing routines for pictures.

Loading images

Matplotlib's imread function opens a PNG image from the hard drive and returns an N x M x 3 (or N x M x 4 if there is an alpha transparency ...

Get Learning IPython for Interactive Computing and Data Visualization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.