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
A simple, good-looking plot
Plotting a scatter of points
Subplots
Horizontal arrangement of subplots
Horizontal arrangement of subplots
A simple plotting example
Subplot plot arrangement vertical
Subplot plot arrangement vertical
Simple axes example
3D plotting
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
Plotting in polar coordinates
Subplot grid
Bar plots
Axes
Grid
3D plotting
GridSpec
Demo text printing
Code for the chapter’s exercises¶
Exercise 1
Exercise 4
Exercise 3
Exercise 5
Exercise 6
Exercise 2
Exercise 7
Exercise 8
Exercise 9
Exercise
Example demoing choices for an option¶
The colors matplotlib line plots
The colors matplotlib line plots
Linewidth
Alpha: transparency
Aliased versus anti-aliased
Aliased versus anti-aliased
Marker size
Marker edge width
Colormaps
Solid joint style
Solid cap style
Marker edge color
Marker face color
Dash capstyle
Dash join style
Markers
Linestyles
Locators for tick on axis
Code generating the summary figures with a title¶
3D plotting vignette
Plotting in polar, decorated
Plot example vignette
Multiple plots vignette
Boxplot with matplotlib
Plot scatter decorated
Pie chart vignette
Imshow demo
Bar plot advanced
Plotting quiver decorated
Display the contours of a function
Display the contours of a function
Grid elaborate
Text printing decorated