Examples#
For an overview of the plotting methods we provide, seePlot types
This page contains example plots. Click on any image to see the full imageand source code.
For longer tutorials, see ourtutorials page.You can also findexternal resources andaFAQ in ouruser guide.
Tagging!
You can also browse the example gallery bytags.
Lines, bars and markers#

Shade regions defined by a logical mask using fill_between
Images, contours and fields#
Subplots, axes and figures#

Controlling view limits using margins and sticky_edges
Statistics#

Plot a confidence ellipse of a two-dimensional dataset

Create boxes from error bars using PatchCollection

Demo of the histogram function's different histtype settings

The histogram (hist) function with multiple data sets
Pie and polar charts#
Text, labels and annotations#

Concatenate text objects with different properties

Controlling style of text and labels using a dictionary
Color#
For a description of the colormaps available in Matplotlib,see thecolormaps tutorial.
Shapes and collections#

Line, Poly and RegularPoly Collection with autoscaling
Style sheets#
Module - pyplot#
Module - axes_grid1#

Control the position and size of a colorbar with Inset Axes

Align histogram to scatter plot using locatable Axes
Module - axisartist#
Showcase#
Animation#
Event handling#
Matplotlib supportsevent handling witha GUI neutral event model, so you can connect to Matplotlib events withoutknowledge of what user interface Matplotlib will ultimately be plugged in to.This has two advantages: the code you write will be more portable, andMatplotlib events are aware of things like data coordinate space and whichaxes the event occurs in so you don't have to mess with low leveltransformation details to go from canvas space to data space. Object pickingexamples are also included.
Miscellaneous#

Building histograms using Rectangles and PolyCollections
3D plotting#

Plot contour (level) curves in 3D using the extend3d option

3D voxel / volumetric plot with cylindrical coordinates
Scales#
These examples cover how different scales are handled in Matplotlib.
Specialty plots#

SkewT-logP diagram: using transforms and custom projections
Spines#
Ticks#

SI prefixed offsets and natural order of magnitudes
Units#
These examples cover the many representations of unitsin Matplotlib.
Embedding Matplotlib in graphical user interfaces#
You can embed Matplotlib directly into a user interface application byfollowing the embedding_in_SOMEGUI.py examples here. CurrentlyMatplotlib supports PyQt/PySide, PyGObject, Tkinter, and wxPython.
When embedding Matplotlib in a GUI, you must use the Matplotlib APIdirectly rather than the pylab/pyplot procedural interface, so take alook at the examples/api directory for some example code working withthe API.
Widgets#
Examples of how to write primitive, but GUI agnostic, widgets inmatplotlib

Select indices from a collection using polygon selector