Examples#

This page contains example plots. Click on any image to see the full image and source code.

For longer tutorials, see our tutorials page. You can also find external resources and a FAQ in our user guide.

Lines, bars and markers#

Bar color demo

Bar color demo

Bar color demo
Bar Label Demo

Bar Label Demo

Bar Label Demo
Stacked bar chart

Stacked bar chart

Stacked bar chart
Grouped bar chart with labels

Grouped bar chart with labels

Grouped bar chart with labels
Horizontal bar chart

Horizontal bar chart

Horizontal bar chart
Broken Barh

Broken Barh

Broken Barh
CapStyle

CapStyle

CapStyle
Plotting categorical variables

Plotting categorical variables

Plotting categorical variables
Plotting the coherence of two signals

Plotting the coherence of two signals

Plotting the coherence of two signals
CSD Demo

CSD Demo

CSD Demo
Curve with error band

Curve with error band

Curve with error band
Errorbar limit selection

Errorbar limit selection

Errorbar limit selection
Errorbar subsampling

Errorbar subsampling

Errorbar subsampling
EventCollection Demo

EventCollection Demo

EventCollection Demo
Eventplot Demo

Eventplot Demo

Eventplot Demo
Filled polygon

Filled polygon

Filled polygon
Fill Between and Alpha

Fill Between and Alpha

Fill Between and Alpha
Filling the area between lines

Filling the area between lines

Filling the area between lines
Fill Betweenx Demo

Fill Betweenx Demo

Fill Betweenx Demo
Hatch-filled histograms

Hatch-filled histograms

Hatch-filled histograms
Bar chart with gradients

Bar chart with gradients

Bar chart with gradients
Hat graph

Hat graph

Hat graph
Discrete distribution as horizontal bar chart

Discrete distribution as horizontal bar chart

Discrete distribution as horizontal bar chart
JoinStyle

JoinStyle

JoinStyle
Customizing dashed line styles

Customizing dashed line styles

Customizing dashed line styles
Lines with a ticked patheffect

Lines with a ticked patheffect

Lines with a ticked patheffect
Linestyles

Linestyles

Linestyles
Marker reference

Marker reference

Marker reference
Markevery Demo

Markevery Demo

Markevery Demo
Plotting masked and NaN values

Plotting masked and NaN values

Plotting masked and NaN values
Multicolored lines

Multicolored lines

Multicolored lines
Mapping marker properties to multivariate data

Mapping marker properties to multivariate data

Mapping marker properties to multivariate data
Psd Demo

Psd Demo

Psd Demo
Scatter plots with custom symbols

Scatter plots with custom symbols

Scatter plots with custom symbols
Scatter Demo2

Scatter Demo2

Scatter Demo2
Scatter plot with histograms

Scatter plot with histograms

Scatter plot with histograms
Scatter Masked

Scatter Masked

Scatter Masked
Marker examples

Marker examples

Marker examples
Scatter plots with a legend

Scatter plots with a legend

Scatter plots with a legend
Simple Plot

Simple Plot

Simple Plot
Using span_where

Using span_where

Using span_where
Spectrum Representations

Spectrum Representations

Spectrum Representations
Stackplots and streamgraphs

Stackplots and streamgraphs

Stackplots and streamgraphs
Stairs Demo

Stairs Demo

Stairs Demo
Stem Plot

Stem Plot

Stem Plot
Step Demo

Step Demo

Step Demo
Creating a timeline with lines, dates, and text

Creating a timeline with lines, dates, and text

Creating a timeline with lines, dates, and text
hlines and vlines

hlines and vlines

hlines and vlines
Cross- and Auto-Correlation Demo

Cross- and Auto-Correlation Demo

Cross- and Auto-Correlation Demo

Images, contours and fields#

Affine transform of an image

Affine transform of an image

Affine transform of an image
Wind Barbs

Wind Barbs

Wind Barbs
Barcode

Barcode

Barcode
Interactive Adjustment of Colormap Range

Interactive Adjustment of Colormap Range

Interactive Adjustment of Colormap Range
Colormap Normalizations

Colormap Normalizations

Colormap Normalizations
Colormap Normalizations SymLogNorm

Colormap Normalizations SymLogNorm

Colormap Normalizations SymLogNorm
Contour Corner Mask

Contour Corner Mask

Contour Corner Mask
Contour Demo

Contour Demo

Contour Demo
Contour Image

Contour Image

Contour Image
Contour Label Demo

Contour Label Demo

Contour Label Demo
Contourf Demo

Contourf Demo

Contourf Demo
Contourf Hatching

Contourf Hatching

Contourf Hatching
Contourf and log color scale

Contourf and log color scale

Contourf and log color scale
Contouring the solution space of optimizations

Contouring the solution space of optimizations

Contouring the solution space of optimizations
BboxImage Demo

BboxImage Demo

BboxImage Demo
Figimage Demo

Figimage Demo

Figimage Demo
Creating annotated heatmaps

Creating annotated heatmaps

Creating annotated heatmaps
Image antialiasing

Image antialiasing

Image antialiasing
Clipping images with patches

Clipping images with patches

Clipping images with patches
Image Demo

Image Demo

Image Demo
Image Masked

Image Masked

Image Masked
Image Nonuniform

Image Nonuniform

Image Nonuniform
Blend transparency with color in 2D images

Blend transparency with color in 2D images

Blend transparency with color in 2D images
Modifying the coordinate formatter

Modifying the coordinate formatter

Modifying the coordinate formatter
Interpolations for imshow

Interpolations for imshow

Interpolations for imshow
Contour plot of irregularly spaced data

Contour plot of irregularly spaced data

Contour plot of irregularly spaced data
Layer Images

Layer Images

Layer Images
Matshow

Matshow

Matshow
Multi Image

Multi Image

Multi Image
Pcolor Demo

Pcolor Demo

Pcolor Demo
pcolormesh grids and shading

pcolormesh grids and shading

pcolormesh grids and shading
pcolormesh

pcolormesh

pcolormesh
Streamplot

Streamplot

Streamplot
QuadMesh Demo

QuadMesh Demo

QuadMesh Demo
Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions
Quiver Simple Demo

Quiver Simple Demo

Quiver Simple Demo
Shading example

Shading example

Shading example
Spectrogram Demo

Spectrogram Demo

Spectrogram Demo
Spy Demos

Spy Demos

Spy Demos
Tricontour Demo

Tricontour Demo

Tricontour Demo
Tricontour Smooth Delaunay

Tricontour Smooth Delaunay

Tricontour Smooth Delaunay
Tricontour Smooth User

Tricontour Smooth User

Tricontour Smooth User
Trigradient Demo

Trigradient Demo

Trigradient Demo
Triinterp Demo

Triinterp Demo

Triinterp Demo
Tripcolor Demo

Tripcolor Demo

Tripcolor Demo
Triplot Demo

Triplot Demo

Triplot Demo
Watermark image

Watermark image

Watermark image

Subplots, axes and figures#

Aligning Labels

Aligning Labels

Aligning Labels
Axes box aspect

Axes box aspect

Axes box aspect
Axes Demo

Axes Demo

Axes Demo
Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges
Axes Props

Axes Props

Axes Props
Axes Zoom Effect

Axes Zoom Effect

Axes Zoom Effect
axhspan Demo

axhspan Demo

axhspan Demo
Equal axis aspect ratio

Equal axis aspect ratio

Equal axis aspect ratio
Axis Label Position

Axis Label Position

Axis Label Position
Broken Axis

Broken Axis

Broken Axis
Placing Colorbars

Placing Colorbars

Placing Colorbars
Custom Figure subclasses

Custom Figure subclasses

Custom Figure subclasses
Resizing axes with constrained layout

Resizing axes with constrained layout

Resizing axes with constrained layout
Resizing axes with tight layout

Resizing axes with tight layout

Resizing axes with tight layout
Different scales on the same axes

Different scales on the same axes

Different scales on the same axes
Figure size in different units

Figure size in different units

Figure size in different units
Figure labels: suptitle, supxlabel, supylabel

Figure labels: suptitle, supxlabel, supylabel

Figure labels: suptitle, supxlabel, supylabel
Creating adjacent subplots

Creating adjacent subplots

Creating adjacent subplots
Geographic Projections

Geographic Projections

Geographic Projections
Combining two subplots using subplots and GridSpec

Combining two subplots using subplots and GridSpec

Combining two subplots using subplots and GridSpec
Using Gridspec to make multi-column/row subplot layouts

Using Gridspec to make multi-column/row subplot layouts

Using Gridspec to make multi-column/row subplot layouts
Nested Gridspecs

Nested Gridspecs

Nested Gridspecs
Invert Axes

Invert Axes

Invert Axes
Managing multiple figures in pyplot

Managing multiple figures in pyplot

Managing multiple figures in pyplot
Secondary Axis

Secondary Axis

Secondary Axis
Sharing axis limits and views

Sharing axis limits and views

Sharing axis limits and views
Shared Axis

Shared Axis

Shared Axis
Figure subfigures

Figure subfigures

Figure subfigures
Multiple subplots

Multiple subplots

Multiple subplots
Subplots spacings and margins

Subplots spacings and margins

Subplots spacings and margins
Creating multiple subplots using ``plt.subplots``

Creating multiple subplots using plt.subplots

Creating multiple subplots using ``plt.subplots``
Plots with different scales

Plots with different scales

Plots with different scales
Zoom region inset axes

Zoom region inset axes

Zoom region inset axes

Statistics#

Percentiles as horizontal bar chart

Percentiles as horizontal bar chart

Percentiles as horizontal bar chart
Artist customization in box plots

Artist customization in box plots

Artist customization in box plots
Box plots with custom fill colors

Box plots with custom fill colors

Box plots with custom fill colors
Boxplots

Boxplots

Boxplots
Box plot vs. violin plot comparison

Box plot vs. violin plot comparison

Box plot vs. violin plot comparison
Boxplot drawer function

Boxplot drawer function

Boxplot drawer function
Plot a confidence ellipse of a two-dimensional dataset

Plot a confidence ellipse of a two-dimensional dataset

Plot a confidence ellipse of a two-dimensional dataset
Violin plot customization

Violin plot customization

Violin plot customization
Errorbar function

Errorbar function

Errorbar function
Different ways of specifying error bars

Different ways of specifying error bars

Different ways of specifying error bars
Including upper and lower limits in error bars

Including upper and lower limits in error bars

Including upper and lower limits in error bars
Creating boxes from error bars using PatchCollection

Creating boxes from error bars using PatchCollection

Creating boxes from error bars using PatchCollection
Hexagonal binned plot

Hexagonal binned plot

Hexagonal binned plot
Histograms

Histograms

Histograms
Using histograms to plot a cumulative distribution

Using histograms to plot a cumulative distribution

Using histograms to plot a cumulative distribution
Some features of the histogram (hist) function

Some features of the histogram (hist) function

Some features of the histogram (hist) function
Demo of the histogram function's different ``histtype`` settings

Demo of the histogram function's different histtype settings

Demo of the histogram function's different ``histtype`` settings
The histogram (hist) function with multiple data sets

The histogram (hist) function with multiple data sets

The histogram (hist) function with multiple data sets
Producing multiple histograms side by side

Producing multiple histograms side by side

Producing multiple histograms side by side
Time Series Histogram

Time Series Histogram

Time Series Histogram
Violin plot basics

Violin plot basics

Violin plot basics

Pie and polar charts#

Basic pie chart

Basic pie chart

Basic pie chart
Pie Demo2

Pie Demo2

Pie Demo2
Bar of pie

Bar of pie

Bar of pie
Nested pie charts

Nested pie charts

Nested pie charts
Labeling a pie and a donut

Labeling a pie and a donut

Labeling a pie and a donut
Bar chart on polar axis

Bar chart on polar axis

Bar chart on polar axis
Polar plot

Polar plot

Polar plot
Polar Legend

Polar Legend

Polar Legend
Scatter plot on polar axis

Scatter plot on polar axis

Scatter plot on polar axis

Text, labels and annotations#

Using accented text in Matplotlib

Using accented text in Matplotlib

Using accented text in Matplotlib
Scale invariant angle label

Scale invariant angle label

Scale invariant angle label
Annotating Plots

Annotating Plots

Annotating Plots
Arrow Demo

Arrow Demo

Arrow Demo
Auto-wrapping text

Auto-wrapping text

Auto-wrapping text
Composing Custom Legends

Composing Custom Legends

Composing Custom Legends
Date tick labels

Date tick labels

Date tick labels
AnnotationBbox demo

AnnotationBbox demo

AnnotationBbox demo
Using a text as a Path

Using a text as a Path

Using a text as a Path
Text Rotation Mode

Text Rotation Mode

Text Rotation Mode
The difference between \\dfrac and \\frac

The difference between \dfrac and \frac

The difference between \\dfrac and \\frac
Labeling ticks using engineering notation

Labeling ticks using engineering notation

Labeling ticks using engineering notation
Annotation arrow style reference

Annotation arrow style reference

Annotation arrow style reference
Styling text boxes

Styling text boxes

Styling text boxes
Figure legend demo

Figure legend demo

Figure legend demo
Configuring the font family

Configuring the font family

Configuring the font family
Using a ttf font file in Matplotlib

Using a ttf font file in Matplotlib

Using a ttf font file in Matplotlib
Font table

Font table

Font table
Fonts demo (object-oriented style)

Fonts demo (object-oriented style)

Fonts demo (object-oriented style)
Fonts demo (keyword arguments)

Fonts demo (keyword arguments)

Fonts demo (keyword arguments)
Labelling subplots

Labelling subplots

Labelling subplots
Legend using pre-defined labels

Legend using pre-defined labels

Legend using pre-defined labels
Legend Demo

Legend Demo

Legend Demo
Artist within an artist

Artist within an artist

Artist within an artist
Convert texts to images

Convert texts to images

Convert texts to images
Mathtext

Mathtext

Mathtext
Mathtext Examples

Mathtext Examples

Mathtext Examples
Math fontfamily

Math fontfamily

Math fontfamily
Multiline

Multiline

Multiline
Placing text boxes

Placing text boxes

Placing text boxes
Rainbow text

Rainbow text

Rainbow text
STIX Fonts

STIX Fonts

STIX Fonts
Rendering math equations using TeX

Rendering math equations using TeX

Rendering math equations using TeX
Text alignment

Text alignment

Text alignment
Controlling style of text and labels using a dictionary

Controlling style of text and labels using a dictionary

Controlling style of text and labels using a dictionary
Default text rotation demonstration

Default text rotation demonstration

Default text rotation demonstration
Text Rotation Relative To Line

Text Rotation Relative To Line

Text Rotation Relative To Line
Title positioning

Title positioning

Title positioning
Unicode minus

Unicode minus

Unicode minus
Usetex Baseline Test

Usetex Baseline Test

Usetex Baseline Test
Usetex Fonteffects

Usetex Fonteffects

Usetex Fonteffects
Text watermark

Text watermark

Text watermark

pyplot#

Align y-labels

Align y-labels

Align y-labels
Annotate Transform

Annotate Transform

Annotate Transform
Annotating a plot

Annotating a plot

Annotating a plot
Annotation Polar

Annotation Polar

Annotation Polar
Programmatically controlling subplot adjustment

Programmatically controlling subplot adjustment

Programmatically controlling subplot adjustment
Infinite lines

Infinite lines

Infinite lines
Boxplot Demo

Boxplot Demo

Boxplot Demo
Dollar Ticks

Dollar Ticks

Dollar Ticks
Fig Axes Customize Simple

Fig Axes Customize Simple

Fig Axes Customize Simple
Simple axes labels

Simple axes labels

Simple axes labels
Adding lines to figures

Adding lines to figures

Adding lines to figures
plot() format string

plot() format string

plot() format string
Pyplot Mathtext

Pyplot Mathtext

Pyplot Mathtext
Pyplot Simple

Pyplot Simple

Pyplot Simple
Pyplot Text

Pyplot Text

Pyplot Text
Pyplot Three

Pyplot Three

Pyplot Three
Pyplot Two Subplots

Pyplot Two Subplots

Pyplot Two Subplots
Text Commands

Text Commands

Text Commands
Text Layout

Text Layout

Text Layout

Color#

For more in-depth information about the colormaps available in matplotlib as well as a description of their properties, see the colormaps tutorial.

Color Demo

Color Demo

Color Demo
Color by y-value

Color by y-value

Color by y-value
Colors in the default property cycle

Colors in the default property cycle

Colors in the default property cycle
Colorbar

Colorbar

Colorbar
Colormap reference

Colormap reference

Colormap reference
Creating a colormap from a list of colors

Creating a colormap from a list of colors

Creating a colormap from a list of colors
List of named colors

List of named colors

List of named colors

Shapes and collections#

Arrow guide

Arrow guide

Arrow guide
Reference for Matplotlib artists

Reference for Matplotlib artists

Reference for Matplotlib artists
Line, Poly and RegularPoly Collection with autoscaling

Line, Poly and RegularPoly Collection with autoscaling

Line, Poly and RegularPoly Collection with autoscaling
Compound path

Compound path

Compound path
Dolphins

Dolphins

Dolphins
Mmh Donuts!!!

Mmh Donuts!!!

Mmh Donuts!!!
Ellipse Collection

Ellipse Collection

Ellipse Collection
Ellipse Demo

Ellipse Demo

Ellipse Demo
Drawing fancy boxes

Drawing fancy boxes

Drawing fancy boxes
Hatch demo

Hatch demo

Hatch demo
Hatch style reference

Hatch style reference

Hatch style reference
Line Collection

Line Collection

Line Collection
Circles, Wedges and Polygons

Circles, Wedges and Polygons

Circles, Wedges and Polygons
PathPatch object

PathPatch object

PathPatch object
Bezier Curve

Bezier Curve

Bezier Curve
Scatter plot

Scatter plot

Scatter plot

Style sheets#

Bayesian Methods for Hackers style sheet

Bayesian Methods for Hackers style sheet

Bayesian Methods for Hackers style sheet
Dark background style sheet

Dark background style sheet

Dark background style sheet
FiveThirtyEight style sheet

FiveThirtyEight style sheet

FiveThirtyEight style sheet
ggplot style sheet

ggplot style sheet

ggplot style sheet
Grayscale style sheet

Grayscale style sheet

Grayscale style sheet
Solarized Light stylesheet

Solarized Light stylesheet

Solarized Light stylesheet
Style sheets reference

Style sheets reference

Style sheets reference

axes_grid1#

Anchored Direction Arrow

Anchored Direction Arrow

Anchored Direction Arrow
Axes Divider

Axes Divider

Axes Divider
Demo Axes Grid

Demo Axes Grid

Demo Axes Grid
Axes Grid2

Axes Grid2

Axes Grid2
`.HBoxDivider` demo

HBoxDivider demo

`.HBoxDivider` demo
Showing RGB channels using RGBAxes

Showing RGB channels using RGBAxes

Showing RGB channels using RGBAxes
Adding a colorbar to inset axes

Adding a colorbar to inset axes

Adding a colorbar to inset axes
Colorbar with `.AxesDivider`

Colorbar with AxesDivider

Colorbar with `.AxesDivider`
Controlling the position and size of colorbars with Inset Axes

Controlling the position and size of colorbars with Inset Axes

Controlling the position and size of colorbars with Inset Axes
Per-row or per-column colorbars

Per-row or per-column colorbars

Per-row or per-column colorbars
Axes with a fixed physical size

Axes with a fixed physical size

Axes with a fixed physical size
Setting a fixed aspect on ImageGrid cells

Setting a fixed aspect on ImageGrid cells

Setting a fixed aspect on ImageGrid cells
Inset Locator Demo

Inset Locator Demo

Inset Locator Demo
Inset Locator Demo 2

Inset Locator Demo 2

Inset Locator Demo 2
Make room for ylabel using axes_grid

Make room for ylabel using axes_grid

Make room for ylabel using axes_grid
Parasite Simple

Parasite Simple

Parasite Simple
Parasite Simple2

Parasite Simple2

Parasite Simple2
Scatter Histogram (Locatable Axes)

Scatter Histogram (Locatable Axes)

Scatter Histogram (Locatable Axes)
Simple Anchored Artists

Simple Anchored Artists

Simple Anchored Artists
Simple Axes Divider 1

Simple Axes Divider 1

Simple Axes Divider 1
Simple Axes Divider 3

Simple Axes Divider 3

Simple Axes Divider 3
Simple ImageGrid

Simple ImageGrid

Simple ImageGrid
Simple ImageGrid 2

Simple ImageGrid 2

Simple ImageGrid 2
Simple Axisline4

Simple Axisline4

Simple Axisline4
Simple Colorbar

Simple Colorbar

Simple Colorbar

axisartist#

Axis Direction

Axis Direction

Axis Direction
axis_direction demo

axis_direction demo

axis_direction demo
Axis line styles

Axis line styles

Axis line styles
Curvilinear grid demo

Curvilinear grid demo

Curvilinear grid demo
Demo CurveLinear Grid2

Demo CurveLinear Grid2

Demo CurveLinear Grid2
:mod:`mpl_toolkits.axisartist.floating_axes` features

mpl_toolkits.axisartist.floating_axes features

:mod:`mpl_toolkits.axisartist.floating_axes` features
floating_axis demo

floating_axis demo

floating_axis demo
Parasite Axes demo

Parasite Axes demo

Parasite Axes demo
Parasite axis demo

Parasite axis demo

Parasite axis demo
Ticklabel alignment

Ticklabel alignment

Ticklabel alignment
Ticklabel direction

Ticklabel direction

Ticklabel direction
Simple Axis Direction01

Simple Axis Direction01

Simple Axis Direction01
Simple Axis Direction03

Simple Axis Direction03

Simple Axis Direction03
Simple Axis Pad

Simple Axis Pad

Simple Axis Pad
Custom spines with axisartist

Custom spines with axisartist

Custom spines with axisartist
Simple Axisline

Simple Axisline

Simple Axisline
Simple Axisline3

Simple Axisline3

Simple Axisline3

Showcase#

Anatomy of a figure

Anatomy of a figure

Anatomy of a figure
Firefox

Firefox

Firefox
Integral as the area under a curve

Integral as the area under a curve

Integral as the area under a curve
Shaded & power normalized rendering

Shaded & power normalized rendering

Shaded & power normalized rendering
Stock prices over 32 years

Stock prices over 32 years

Stock prices over 32 years
XKCD

XKCD

XKCD

Animation#

Decay

Decay

Decay
Animated histogram

Animated histogram

Animated histogram
pyplot animation

pyplot animation

pyplot animation
The Bayes update

The Bayes update

The Bayes update
The double pendulum problem

The double pendulum problem

The double pendulum problem
Animated image using a precomputed list of images

Animated image using a precomputed list of images

Animated image using a precomputed list of images
Frame grabbing

Frame grabbing

Frame grabbing
Multiple axes animation

Multiple axes animation

Multiple axes animation
Pausing and Resuming an Animation

Pausing and Resuming an Animation

Pausing and Resuming an Animation
Rain simulation

Rain simulation

Rain simulation
Animated 3D random walk

Animated 3D random walk

Animated 3D random walk
Animated line plot

Animated line plot

Animated line plot
Oscilloscope

Oscilloscope

Oscilloscope
MATPLOTLIB **UNCHAINED**

MATPLOTLIB UNCHAINED

MATPLOTLIB **UNCHAINED**

Event handling#

Matplotlib supports event handling with a GUI neutral event model, so you can connect to Matplotlib events without knowledge of what user interface Matplotlib will ultimately be plugged in to. This has two advantages: the code you write will be more portable, and Matplotlib events are aware of things like data coordinate space and which axes the event occurs in so you don't have to mess with low level transformation details to go from canvas space to data space. Object picking examples are also included.

Close Event

Close Event

Close Event
Mouse move and click events

Mouse move and click events

Mouse move and click events
Cross hair cursor

Cross hair cursor

Cross hair cursor
Data Browser

Data Browser

Data Browser
Figure/Axes enter and leave events

Figure/Axes enter and leave events

Figure/Axes enter and leave events
Interactive functions

Interactive functions

Interactive functions
Image Slices Viewer

Image Slices Viewer

Image Slices Viewer
Keypress event

Keypress event

Keypress event
Lasso Demo

Lasso Demo

Lasso Demo
Legend Picking

Legend Picking

Legend Picking
Looking Glass

Looking Glass

Looking Glass
Path Editor

Path Editor

Path Editor
Pick Event Demo

Pick Event Demo

Pick Event Demo
Pick Event Demo2

Pick Event Demo2

Pick Event Demo2
Poly Editor

Poly Editor

Poly Editor
Pong

Pong

Pong
Resampling Data

Resampling Data

Resampling Data
Timers

Timers

Timers
Trifinder Event Demo

Trifinder Event Demo

Trifinder Event Demo
Viewlims

Viewlims

Viewlims
Zoom Window

Zoom Window

Zoom Window

Miscellaneous#

Anchored Artists

Anchored Artists

Anchored Artists
Changing colors of lines intersecting a box

Changing colors of lines intersecting a box

Changing colors of lines intersecting a box
Manual Contour

Manual Contour

Manual Contour
Coords Report

Coords Report

Coords Report
Custom projection

Custom projection

Custom projection
Customize Rc

Customize Rc

Customize Rc
AGG filter

AGG filter

AGG filter
Ribbon Box

Ribbon Box

Ribbon Box
Fill Spiral

Fill Spiral

Fill Spiral
Findobj Demo

Findobj Demo

Findobj Demo
Font indexing

Font indexing

Font indexing
Font properties

Font properties

Font properties
Building histograms using Rectangles and PolyCollections

Building histograms using Rectangles and PolyCollections

Building histograms using Rectangles and PolyCollections
Hyperlinks

Hyperlinks

Hyperlinks
Image Thumbnail

Image Thumbnail

Image Thumbnail
Plotting with keywords

Plotting with keywords

Plotting with keywords
Matplotlib logo

Matplotlib logo

Matplotlib logo
Multipage PDF

Multipage PDF

Multipage PDF
Multiprocess

Multiprocess

Multiprocess
Packed-bubble chart

Packed-bubble chart

Packed-bubble chart
Patheffect Demo

Patheffect Demo

Patheffect Demo
Print Stdout

Print Stdout

Print Stdout
Pythonic Matplotlib

Pythonic Matplotlib

Pythonic Matplotlib
Rasterization for vector graphics

Rasterization for vector graphics

Rasterization for vector graphics
Set and get properties

Set and get properties

Set and get properties
SVG Filter Line

SVG Filter Line

SVG Filter Line
SVG Filter Pie

SVG Filter Pie

SVG Filter Pie
Table Demo

Table Demo

Table Demo
TickedStroke patheffect

TickedStroke patheffect

TickedStroke patheffect
transforms.offset_copy

transforms.offset_copy

transforms.offset_copy
Zorder Demo

Zorder Demo

Zorder Demo

3D plotting#

Plot 2D data on 3D plot

Plot 2D data on 3D plot

Plot 2D data on 3D plot
Demo of 3D bar charts

Demo of 3D bar charts

Demo of 3D bar charts
Create 2D bar graphs in different planes

Create 2D bar graphs in different planes

Create 2D bar graphs in different planes
3D box surface plot

3D box surface plot

3D box surface plot
Plot contour (level) curves in 3D

Plot contour (level) curves in 3D

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

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

Plot contour (level) curves in 3D using the extend3d option
Project contour profiles onto a graph

Project contour profiles onto a graph

Project contour profiles onto a graph
Filled contours

Filled contours

Filled contours
Project filled contour onto a graph

Project filled contour onto a graph

Project filled contour onto a graph
Custom hillshading in a 3D surface plot

Custom hillshading in a 3D surface plot

Custom hillshading in a 3D surface plot
3D errorbars

3D errorbars

3D errorbars
Create 3D histogram of 2D data

Create 3D histogram of 2D data

Create 3D histogram of 2D data
Parametric curve

Parametric curve

Parametric curve
Lorenz attractor

Lorenz attractor

Lorenz attractor
2D and 3D axes in same figure

2D and 3D axes in same figure

2D and 3D axes in same figure
Automatic text offsetting

Automatic text offsetting

Automatic text offsetting
Draw flat objects in 3D plot

Draw flat objects in 3D plot

Draw flat objects in 3D plot
Generate polygons to fill under 3D line graph

Generate polygons to fill under 3D line graph

Generate polygons to fill under 3D line graph
3D plot projection types

3D plot projection types

3D plot projection types
3D quiver plot

3D quiver plot

3D quiver plot
Rotating a 3D plot

Rotating a 3D plot

Rotating a 3D plot
3D scatterplot

3D scatterplot

3D scatterplot
3D stem

3D stem

3D stem
3D plots as subplots

3D plots as subplots

3D plots as subplots
3D surface (colormap)

3D surface (colormap)

3D surface (colormap)
3D surface (solid color)

3D surface (solid color)

3D surface (solid color)
3D surface (checkerboard)

3D surface (checkerboard)

3D surface (checkerboard)
3D surface with polar coordinates

3D surface with polar coordinates

3D surface with polar coordinates
Text annotations in 3D

Text annotations in 3D

Text annotations in 3D
Triangular 3D contour plot

Triangular 3D contour plot

Triangular 3D contour plot
Triangular 3D filled contour plot

Triangular 3D filled contour plot

Triangular 3D filled contour plot
Triangular 3D surfaces

Triangular 3D surfaces

Triangular 3D surfaces
More triangular 3D surfaces

More triangular 3D surfaces

More triangular 3D surfaces
Primary 3D view planes

Primary 3D view planes

Primary 3D view planes
3D voxel / volumetric plot

3D voxel / volumetric plot

3D voxel / volumetric plot
3D voxel plot of the NumPy logo

3D voxel plot of the NumPy logo

3D voxel plot of the NumPy logo
3D voxel / volumetric plot with RGB colors

3D voxel / volumetric plot with RGB colors

3D voxel / volumetric plot with RGB colors
3D voxel / volumetric plot with cylindrical coordinates

3D voxel / volumetric plot with cylindrical coordinates

3D voxel / volumetric plot with cylindrical coordinates
3D wireframe plot

3D wireframe plot

3D wireframe plot
Animate a 3D wireframe plot

Animate a 3D wireframe plot

Animate a 3D wireframe plot
3D wireframe plots in one direction

3D wireframe plots in one direction

3D wireframe plots in one direction

Scales#

These examples cover how different scales are handled in Matplotlib.

Asinh Demo

Asinh Demo

Asinh Demo
Loglog Aspect

Loglog Aspect

Loglog Aspect
Custom scale

Custom scale

Custom scale
Log Bar

Log Bar

Log Bar
Log Demo

Log Demo

Log Demo
Logit Demo

Logit Demo

Logit Demo
Exploring normalizations

Exploring normalizations

Exploring normalizations
Scales

Scales

Scales
Log Axis

Log Axis

Log Axis
Symlog Demo

Symlog Demo

Symlog Demo

Specialty Plots#

Hillshading

Hillshading

Hillshading
Anscombe's quartet

Anscombe's quartet

Anscombe's quartet
Hinton diagrams

Hinton diagrams

Hinton diagrams
Left ventricle bullseye

Left ventricle bullseye

Left ventricle bullseye
===

MRI

===
MRI with EEG

MRI with EEG

MRI with EEG
Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)
The Sankey class

The Sankey class

The Sankey class
Long chain of connections using Sankey

Long chain of connections using Sankey

Long chain of connections using Sankey
Rankine power cycle

Rankine power cycle

Rankine power cycle
SkewT-logP diagram: using transforms and custom projections

SkewT-logP diagram: using transforms and custom projections

SkewT-logP diagram: using transforms and custom projections
Topographic hillshading

Topographic hillshading

Topographic hillshading

Spines#

Centered spines with arrows

Centered spines with arrows

Centered spines with arrows
Multiple Yaxis With Spines

Multiple Yaxis With Spines

Multiple Yaxis With Spines
Spine Placement

Spine Placement

Spine Placement
Spines

Spines

Spines
Custom spine bounds

Custom spine bounds

Custom spine bounds
Dropped spines

Dropped spines

Dropped spines

Ticks#

Automatically setting tick positions

Automatically setting tick positions

Automatically setting tick positions
Centering labels between ticks

Centering labels between ticks

Centering labels between ticks
Colorbar Tick Labelling

Colorbar Tick Labelling

Colorbar Tick Labelling
Custom Ticker

Custom Ticker

Custom Ticker
Formatting date ticks using ConciseDateFormatter

Formatting date ticks using ConciseDateFormatter

Formatting date ticks using ConciseDateFormatter
Date Demo Convert

Date Demo Convert

Date Demo Convert
Placing date ticks using recurrence rules

Placing date ticks using recurrence rules

Placing date ticks using recurrence rules
Date tick locators and formatters

Date tick locators and formatters

Date tick locators and formatters
Custom tick formatter for time series

Custom tick formatter for time series

Custom tick formatter for time series
Date Precision and Epochs

Date Precision and Epochs

Date Precision and Epochs
Major and minor ticks

Major and minor ticks

Major and minor ticks
The default tick formatter

The default tick formatter

The default tick formatter
Tick formatters

Tick formatters

Tick formatters
Tick locators

Tick locators

Tick locators
Set default y-axis tick labels on the right

Set default y-axis tick labels on the right

Set default y-axis tick labels on the right
Setting tick labels from a list of values

Setting tick labels from a list of values

Setting tick labels from a list of values
Move x-axis tick labels to the top

Move x-axis tick labels to the top

Move x-axis tick labels to the top
Rotating custom tick labels

Rotating custom tick labels

Rotating custom tick labels
Fixing too many ticks

Fixing too many ticks

Fixing too many ticks

Units#

These examples cover the many representations of units in Matplotlib.

Annotation with units

Annotation with units

Annotation with units
Artist tests

Artist tests

Artist tests
Bar demo with units

Bar demo with units

Bar demo with units
Group barchart with units

Group barchart with units

Group barchart with units
Basic Units

Basic Units

Basic Units
Ellipse with units

Ellipse with units

Ellipse with units
Evans test

Evans test

Evans test
Radian ticks

Radian ticks

Radian ticks
Inches and Centimeters

Inches and Centimeters

Inches and Centimeters
Unit handling

Unit handling

Unit handling

Embedding Matplotlib in graphical user interfaces#

You can embed Matplotlib directly into a user interface application by following the embedding_in_SOMEGUI.py examples here. Currently Matplotlib supports PyQt/PySide, PyGObject, Tkinter, and wxPython.

When embedding Matplotlib in a GUI, you must use the Matplotlib API directly rather than the pylab/pyplot procedural interface, so take a look at the examples/api directory for some example code working with the API.

CanvasAgg demo

CanvasAgg demo

CanvasAgg demo
Embedding in GTK3 with a navigation toolbar

Embedding in GTK3 with a navigation toolbar

Embedding in GTK3 with a navigation toolbar
Embedding in GTK3

Embedding in GTK3

Embedding in GTK3
Embedding in GTK4 with a navigation toolbar

Embedding in GTK4 with a navigation toolbar

Embedding in GTK4 with a navigation toolbar
Embedding in GTK4

Embedding in GTK4

Embedding in GTK4
Embedding in Qt

Embedding in Qt

Embedding in Qt
Embedding in Tk

Embedding in Tk

Embedding in Tk
Embedding in wx #2

Embedding in wx #2

Embedding in wx #2
Embedding in wx #3

Embedding in wx #3

Embedding in wx #3
Embedding in wx #4

Embedding in wx #4

Embedding in wx #4
Embedding in wx #5

Embedding in wx #5

Embedding in wx #5
Embedding WebAgg

Embedding WebAgg

Embedding WebAgg
Fourier Demo WX

Fourier Demo WX

Fourier Demo WX
GTK3 Spreadsheet

GTK3 Spreadsheet

GTK3 Spreadsheet
GTK4 Spreadsheet

GTK4 Spreadsheet

GTK4 Spreadsheet
MathText WX

MathText WX

MathText WX
Matplotlib with Glade 3

Matplotlib with Glade 3

Matplotlib with Glade 3
pyplot with GTK3

pyplot with GTK3

pyplot with GTK3
pyplot with GTK4

pyplot with GTK4

pyplot with GTK4
SVG Histogram

SVG Histogram

SVG Histogram
SVG Tooltip

SVG Tooltip

SVG Tooltip
Tool Manager

Tool Manager

Tool Manager
Embedding in a web application server (Flask)

Embedding in a web application server (Flask)

Embedding in a web application server (Flask)
Adding a cursor in WX

Adding a cursor in WX

Adding a cursor in WX

Userdemo#

Anchored Box04

Anchored Box04

Anchored Box04
Annotate Explain

Annotate Explain

Annotate Explain
Annotate Simple01

Annotate Simple01

Annotate Simple01
Annotate Simple02

Annotate Simple02

Annotate Simple02
Annotate Simple03

Annotate Simple03

Annotate Simple03
Annotate Simple04

Annotate Simple04

Annotate Simple04
Annotate Simple Coord01

Annotate Simple Coord01

Annotate Simple Coord01
Annotate Simple Coord02

Annotate Simple Coord02

Annotate Simple Coord02
Annotate Simple Coord03

Annotate Simple Coord03

Annotate Simple Coord03
Annotate Text Arrow

Annotate Text Arrow

Annotate Text Arrow
Connect Simple01

Connect Simple01

Connect Simple01
Connection styles for annotations

Connection styles for annotations

Connection styles for annotations
Custom box styles

Custom box styles

Custom box styles
subplot2grid demo

subplot2grid demo

subplot2grid demo
GridSpec demo

GridSpec demo

GridSpec demo
Nested GridSpecs

Nested GridSpecs

Nested GridSpecs
PGF fonts

PGF fonts

PGF fonts
PGF preamble

PGF preamble

PGF preamble
PGF texsystem

PGF texsystem

PGF texsystem
Simple Annotate01

Simple Annotate01

Simple Annotate01
Simple Legend01

Simple Legend01

Simple Legend01
Simple Legend02

Simple Legend02

Simple Legend02

Widgets#

Examples of how to write primitive, but GUI agnostic, widgets in matplotlib

Annotated Cursor

Annotated Cursor

Annotated Cursor
Buttons

Buttons

Buttons
Check Buttons

Check Buttons

Check Buttons
Cursor

Cursor

Cursor
Lasso Selector

Lasso Selector

Lasso Selector
Menu

Menu

Menu
Mouse Cursor

Mouse Cursor

Mouse Cursor
Multicursor

Multicursor

Multicursor
Select indices from a collection using polygon selector

Select indices from a collection using polygon selector

Select indices from a collection using polygon selector
Polygon Selector

Polygon Selector

Polygon Selector
Radio Buttons

Radio Buttons

Radio Buttons
Thresholding an Image with RangeSlider

Thresholding an Image with RangeSlider

Thresholding an Image with RangeSlider
Rectangle and ellipse selectors

Rectangle and ellipse selectors

Rectangle and ellipse selectors
Slider

Slider

Slider
Snapping Sliders to Discrete Values

Snapping Sliders to Discrete Values

Snapping Sliders to Discrete Values
Span Selector

Span Selector

Span Selector
Textbox

Textbox

Textbox

Gallery generated by Sphinx-Gallery