Code samples for Matplotlib

The examples here are only examples relevant to the points raised in this chapter. The matplotlib documentation comes with a much more exhaustive gallery.

Pie chart

Pie chart

A simple, good-looking plot

A simple, good-looking plot

Plotting a scatter of points

Plotting a scatter of points

Subplots

Subplots

Horizontal arrangement of subplots

Horizontal arrangement of subplots

A simple plotting example

A simple plotting example

Subplot plot arrangement vertical

Subplot plot arrangement vertical

Simple axes example

Simple axes example

3D plotting

3D plotting

Imshow elaborate

Imshow elaborate

Plotting a vector field: quiver

Plotting a vector field: quiver

Displaying the contours of a function

Displaying the contours of a function

A example of plotting not quite right

A example of plotting not quite right

Plot and filled plots

Plot and filled plots

Plotting in polar coordinates

Plotting in polar coordinates

Subplot grid

Subplot grid

Bar plots

Bar plots

Axes

Axes

Grid

Grid

3D plotting

3D plotting

GridSpec

GridSpec

Demo text printing

Demo text printing

Code for the chapter’s exercises

Exercise 1

Exercise 1

Exercise 4

Exercise 4

Exercise 3

Exercise 3

Exercise 5

Exercise 5

Exercise 6

Exercise 6

Exercise 2

Exercise 2

Exercise 7

Exercise 7

Exercise 8

Exercise 8

Exercise 9

Exercise 9

Exercise

Exercise

Example demoing choices for an option

The colors matplotlib line plots

The colors matplotlib line plots

Linewidth

Linewidth

Alpha: transparency

Alpha: transparency

Aliased versus anti-aliased

Aliased versus anti-aliased

Aliased versus anti-aliased

Aliased versus anti-aliased

Marker size

Marker size

Marker edge width

Marker edge width

Colormaps

Colormaps

Solid joint style

Solid joint style

Solid cap style

Solid cap style

Marker edge color

Marker edge color

Marker face color

Marker face color

Dash capstyle

Dash capstyle

Dash join style

Dash join style

Markers

Markers

Linestyles

Linestyles

Locators for tick on axis

Locators for tick on axis

Code generating the summary figures with a title

3D plotting vignette

3D plotting vignette

Plotting in polar, decorated

Plotting in polar, decorated

Plot example vignette

Plot example vignette

Multiple plots vignette

Multiple plots vignette

Boxplot with matplotlib

Boxplot with matplotlib

Plot scatter decorated

Plot scatter decorated

Pie chart vignette

Pie chart vignette

Imshow demo

Imshow demo

Bar plot advanced

Bar plot advanced

Plotting quiver decorated

Plotting quiver decorated

Display the contours of a function

Display the contours of a function

Grid elaborate

Grid elaborate

Text printing decorated

Text printing decorated

Gallery generated by Sphinx-Gallery