You are reading an old version of the documentation (v3.3.3). For the latest version see https://matplotlib.org/stable/gallery/index.html
Version 3.3.3
matplotlib
Fork me on GitHub
  • Installation
  • Documentation
  • Examples
  • Tutorials
  • Contributing

Navigation

  • index
  • modules |
  • home| 
  • contents »
  • Gallery

Table of Contents

  • Gallery
    • Lines, bars and markers
    • Images, contours and fields
    • Subplots, axes and figures
    • Statistics
    • Pie and polar charts
    • Text, labels and annotations
    • Pyplot
    • Color
    • Shapes and collections
    • Style sheets
    • Axes Grid
    • Axis Artist
    • Showcase
    • Animation
    • Event handling
    • Front Page
    • Miscellaneous
    • 3D plotting
    • Our Favorite Recipes
    • Scales
    • Specialty Plots
    • Ticks and spines
    • Units
    • Embedding Matplotlib in graphical user interfaces
    • Userdemo
    • Widgets

Related Topics

  • Documentation overview
Show Page Source

Gallery¶

This gallery contains examples of the many things you can do with Matplotlib. 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¶

Stacked bar chart

Stacked bar chart¶

Grouped bar chart with labels

Grouped bar chart with labels¶

Horizontal bar chart

Horizontal bar chart¶

Broken Barh

Broken Barh¶

Plotting categorical variables

Plotting categorical variables¶

Plotting the coherence of two signals

Plotting the coherence of two signals¶

CSD Demo

CSD Demo¶

Curve with error band

Curve with error band¶

Errorbar limit selection

Errorbar limit selection¶

Errorbar subsampling

Errorbar subsampling¶

EventCollection Demo

EventCollection Demo¶

Eventplot Demo

Eventplot Demo¶

Filled polygon

Filled polygon¶

Filling the area between lines

Filling the area between lines¶

Fill Betweenx Demo

Fill Betweenx Demo¶

Hatch-filled histograms

Hatch-filled histograms¶

Bar chart with gradients

Bar chart with gradients¶

Discrete distribution as horizontal bar chart

Discrete distribution as horizontal bar chart¶

Join styles and cap styles

Join styles and cap styles¶

Customizing dashed line styles

Customizing dashed line styles¶

Linestyles

Linestyles¶

Marker reference

Marker reference¶

Markevery Demo

Markevery Demo¶

prop_cycle property markevery in rcParams

prop_cycle property markevery in rcParams¶

Plotting masked and NaN values

Plotting masked and NaN values¶

Multicolored lines

Multicolored lines¶

Psd Demo

Psd Demo¶

Scatter Custom Symbol

Scatter Custom Symbol¶

Scatter Demo2

Scatter Demo2¶

Scatter plot with histograms

Scatter plot with histograms¶

Scatter Masked

Scatter Masked¶

Scatter plot with pie chart markers

Scatter plot with pie chart markers¶

Marker examples

Marker examples¶

Scatter Symbol

Scatter Symbol¶

Scatter plots with a legend

Scatter plots with a legend¶

Simple Plot

Simple Plot¶

Using span_where

Using span_where¶

Spectrum Representations

Spectrum Representations¶

Stackplots and streamgraphs

Stackplots and streamgraphs¶

Stem Plot

Stem Plot¶

Step Demo

Step Demo¶

Creating a timeline with lines, dates, and text

Creating a timeline with lines, dates, and text¶

hlines and vlines

hlines and vlines¶

Cross- and Auto-Correlation Demo

Cross- and Auto-Correlation Demo¶

Images, contours and fields¶

Affine transform of an image

Affine transform of an image¶

Barb Demo

Barb Demo¶

Barcode Demo

Barcode Demo¶

Contour Corner Mask

Contour Corner Mask¶

Contour Demo

Contour Demo¶

Contour Image

Contour Image¶

Contour Label Demo

Contour Label Demo¶

Contourf Demo

Contourf Demo¶

Contourf Hatching

Contourf Hatching¶

Contourf and log color scale

Contourf and log color scale¶

BboxImage Demo

BboxImage Demo¶

Figimage Demo

Figimage Demo¶

Creating annotated heatmaps

Creating annotated heatmaps¶

Image antialiasing

Image antialiasing¶

Clipping images with patches

Clipping images with patches¶

Image Demo

Image Demo¶

Image Masked

Image Masked¶

Image Nonuniform

Image Nonuniform¶

Blend transparency with color in 2-D images

Blend transparency with color in 2-D images¶

Modifying the coordinate formatter

Modifying the coordinate formatter¶

Interpolations for imshow

Interpolations for imshow¶

Contour plot of irregularly spaced data

Contour plot of irregularly spaced data¶

Layer Images

Layer Images¶

Matshow

Matshow¶

Multi Image

Multi Image¶

Pcolor Demo

Pcolor Demo¶

pcolormesh grids and shading

pcolormesh grids and shading¶

pcolormesh

pcolormesh¶

Streamplot

Streamplot¶

QuadMesh Demo

QuadMesh Demo¶

Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions¶

Quiver Simple Demo

Quiver Simple Demo¶

Shading example

Shading example¶

Spectrogram Demo

Spectrogram Demo¶

Spy Demos

Spy Demos¶

Tricontour Demo

Tricontour Demo¶

Tricontour Smooth Delaunay

Tricontour Smooth Delaunay¶

Tricontour Smooth User

Tricontour Smooth User¶

Trigradient Demo

Trigradient Demo¶

Triinterp Demo

Triinterp Demo¶

Tripcolor Demo

Tripcolor Demo¶

Triplot Demo

Triplot Demo¶

Watermark image

Watermark image¶

Subplots, axes and figures¶

Aligning Labels

Aligning Labels¶

Axes box aspect

Axes box aspect¶

Axes Demo

Axes Demo¶

Controlling view limits using margins and sticky_edges

Controlling view limits using margins and sticky_edges¶

Axes Props

Axes Props¶

Axes Zoom Effect

Axes Zoom Effect¶

axhspan Demo

axhspan Demo¶

Axis Equal Demo

Axis Equal Demo¶

Axis Label Position

Axis Label Position¶

Broken Axis

Broken Axis¶

Placing Colorbars

Placing Colorbars¶

Custom Figure subclasses

Custom Figure subclasses¶

Resizing axes with constrained layout

Resizing axes with constrained layout¶

Resizing axes with tight layout

Resizing axes with tight layout¶

Different scales on the same axes

Different scales on the same axes¶

Figure Title

Figure Title¶

Creating adjacent subplots

Creating adjacent subplots¶

Geographic Projections

Geographic Projections¶

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¶

Nested Gridspecs

Nested Gridspecs¶

Invert Axes

Invert Axes¶

Multiple Figs Demo

Multiple Figs Demo¶

Secondary Axis

Secondary Axis¶

Shared Axis Demo

Shared Axis Demo¶

Multiple subplots

Multiple subplots¶

Basic Subplot Demo

Basic Subplot Demo¶

Subplot Toolbar

Subplot Toolbar¶

Subplots Adjust

Subplots Adjust¶

Creating multiple subplots using ``plt.subplots``

Creating multiple subplots using plt.subplots¶

Plots with different scales

Plots with different scales¶

Zoom region inset axes

Zoom region inset axes¶

Statistics¶

Percentiles as horizontal bar chart

Percentiles as horizontal bar chart¶

Artist customization in box plots

Artist customization in box plots¶

Box plots with custom fill colors

Box plots with custom fill colors¶

Boxplots

Boxplots¶

Box plot vs. violin plot comparison

Box plot vs. violin plot comparison¶

Boxplot drawer function

Boxplot drawer function¶

Plot a confidence ellipse of a two-dimensional dataset

Plot a confidence ellipse of a two-dimensional dataset¶

Violin plot customization

Violin plot customization¶

Errorbar function

Errorbar function¶

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¶

Creating boxes from error bars using PatchCollection

Creating boxes from error bars using PatchCollection¶

Hexbin Demo

Hexbin Demo¶

Histograms

Histograms¶

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¶

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¶

Producing multiple histograms side by side

Producing multiple histograms side by side¶

Violin plot basics

Violin plot basics¶

Pie and polar charts¶

Basic pie chart

Basic pie chart¶

Pie Demo2

Pie Demo2¶

Bar of pie

Bar of pie¶

Nested pie charts

Nested pie charts¶

Labeling a pie and a donut

Labeling a pie and a donut¶

Bar chart on polar axis

Bar chart on polar axis¶

Polar Demo

Polar Demo¶

Polar Legend

Polar Legend¶

Scatter plot on polar axis

Scatter plot on polar axis¶

Text, labels and annotations¶

Using accented text in matplotlib

Using accented text in matplotlib¶

Annotating Plots

Annotating Plots¶

Arrow Demo

Arrow Demo¶

Arrow Simple Demo

Arrow Simple Demo¶

Auto-wrapping text

Auto-wrapping text¶

Composing Custom Legends

Composing Custom Legends¶

Date tick labels

Date tick labels¶

Custom tick formatter for time series

Custom tick formatter for time series¶

Demo Annotation Box

Demo Annotation Box¶

Demo Text Path

Demo Text Path¶

Demo Text Rotation Mode

Demo Text Rotation Mode¶

The difference between \\dfrac and \\frac

The difference between \dfrac and \frac¶

Labeling ticks using engineering notation

Labeling ticks using engineering notation¶

Fancyarrow Demo

Fancyarrow Demo¶

Fancytextbox Demo

Fancytextbox Demo¶

Figure legend demo

Figure legend demo¶

Configuring the font family

Configuring the font family¶

Using a ttf font file in Matplotlib

Using a ttf font file in Matplotlib¶

Font table

Font table¶

Fonts demo (object-oriented style)

Fonts demo (object-oriented style)¶

Fonts demo (kwargs)

Fonts demo (kwargs)¶

Legend using pre-defined labels

Legend using pre-defined labels¶

Legend Demo

Legend Demo¶

Artist within an artist

Artist within an artist¶

A mathtext image as numpy array

A mathtext image as numpy array¶

Mathtext Demo

Mathtext Demo¶

Mathtext Examples

Mathtext Examples¶

Multiline

Multiline¶

Rainbow text

Rainbow text¶

STIX Fonts Demo

STIX Fonts Demo¶

Rendering math equations using TeX

Rendering math equations using TeX¶

Precise text layout

Precise text layout¶

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¶

Text Rotation Relative To Line

Text Rotation Relative To Line¶

Title positioning

Title positioning¶

Unicode minus

Unicode minus¶

Usetex Baseline Test

Usetex Baseline Test¶

Usetex Fonteffects

Usetex Fonteffects¶

Text watermark

Text watermark¶

Pyplot¶

Align y-labels

Align y-labels¶

Annotate Transform

Annotate Transform¶

Annotating a plot

Annotating a plot¶

Annotation Polar

Annotation Polar¶

Auto Subplots Adjust

Auto Subplots Adjust¶

Infinite lines

Infinite lines¶

Boxplot Demo

Boxplot Demo¶

Dollar Ticks

Dollar Ticks¶

Fig Axes Customize Simple

Fig Axes Customize Simple¶

Simple axes labels

Simple axes labels¶

Adding lines to figures

Adding lines to figures¶

plot() format string

plot() format string¶

Pyplot Mathtext

Pyplot Mathtext¶

Pyplot Simple

Pyplot Simple¶

Pyplot Text

Pyplot Text¶

Pyplot Three

Pyplot Three¶

Pyplot Two Subplots

Pyplot Two Subplots¶

Text Commands

Text Commands¶

Text Layout

Text Layout¶

What's New 1 Subplot3d

What's New 1 Subplot3d¶

Fill Between

Fill Between¶

What's New 0.98.4 Legend

What's New 0.98.4 Legend¶

What's New 0.99 Axes Grid

What's New 0.99 Axes Grid¶

What's New 0.99 Mplot3d

What's New 0.99 Mplot3d¶

What's New 0.99 Spines

What's New 0.99 Spines¶

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 by y-value

Color by y-value¶

Colors in the default property cycle

Colors in the default property cycle¶

Colorbar

Colorbar¶

Colormap reference

Colormap reference¶

Creating a colormap from a list of colors

Creating a colormap from a list of colors¶

List of named colors

List of named colors¶

Shapes and collections¶

Arrow guide

Arrow guide¶

Reference for Matplotlib artists

Reference for Matplotlib artists¶

Line, Poly and RegularPoly Collection with autoscaling

Line, Poly and RegularPoly Collection with autoscaling¶

Compound path

Compound path¶

Dolphins

Dolphins¶

Mmh Donuts!!!

Mmh Donuts!!!¶

Ellipse Collection

Ellipse Collection¶

Ellipse Demo

Ellipse Demo¶

Drawing fancy boxes

Drawing fancy boxes¶

Hatch Demo

Hatch Demo¶

Line Collection

Line Collection¶

Marker Path

Marker Path¶

Circles, Wedges and Polygons

Circles, Wedges and Polygons¶

PathPatch object

PathPatch object¶

Bezier Curve

Bezier Curve¶

Scatter plot

Scatter plot¶

Style sheets¶

Bayesian Methods for Hackers style sheet

Bayesian Methods for Hackers style sheet¶

Dark background style sheet

Dark background style sheet¶

FiveThirtyEight style sheet

FiveThirtyEight style sheet¶

ggplot style sheet

ggplot style sheet¶

Grayscale style sheet

Grayscale style sheet¶

Solarized Light stylesheet

Solarized Light stylesheet¶

Style sheets reference

Style sheets reference¶

Axes Grid¶

Demo Anchored Direction Arrow

Demo Anchored Direction Arrow¶

Demo Axes Divider

Demo Axes Divider¶

Demo Axes Grid

Demo Axes Grid¶

Demo Axes Grid2

Demo Axes Grid2¶

`.HBoxDivider` demo

HBoxDivider demo¶

Demo Axes RGB

Demo Axes RGB¶

Demo Colorbar of Inset Axes

Demo Colorbar of Inset Axes¶

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¶

Demo Edge Colorbar

Demo Edge Colorbar¶

Demo Fixed Size Axes

Demo Fixed Size Axes¶

Demo Imagegrid Aspect

Demo Imagegrid Aspect¶

Inset Locator Demo

Inset Locator Demo¶

Inset Locator Demo2

Inset Locator Demo2¶

Make Room For Ylabel Using Axesgrid

Make Room For Ylabel Using Axesgrid¶

Parasite Simple

Parasite Simple¶

Parasite Simple2

Parasite Simple2¶

Scatter Histogram (Locatable Axes)

Scatter Histogram (Locatable Axes)¶

Simple Anchored Artists

Simple Anchored Artists¶

Simple Axes Divider 1

Simple Axes Divider 1¶

Simple Axes Divider 3

Simple Axes Divider 3¶

Simple ImageGrid

Simple ImageGrid¶

Simple ImageGrid 2

Simple ImageGrid 2¶

Simple Axisline4

Simple Axisline4¶

Simple Colorbar

Simple Colorbar¶

Axis Artist¶

Axis Direction Demo Step01

Axis Direction Demo Step01¶

Axis Direction Demo Step02

Axis Direction Demo Step02¶

Axis Direction Demo Step03

Axis Direction Demo Step03¶

Axis Direction Demo Step04

Axis Direction Demo Step04¶

Demo Axis Direction

Demo Axis Direction¶

Axis line styles

Axis line styles¶

Curvilinear grid demo

Curvilinear grid demo¶

Demo Curvelinear Grid2

Demo Curvelinear Grid2¶

:mod:`mpl_toolkits.axisartist.floating_axes` features

mpl_toolkits.axisartist.floating_axes features¶

Demo Floating Axis

Demo Floating Axis¶

Parasite Axes demo

Parasite Axes demo¶

Parasite axis demo

Parasite axis demo¶

Demo Ticklabel Alignment

Demo Ticklabel Alignment¶

Demo Ticklabel Direction

Demo Ticklabel Direction¶

Simple Axis Direction01

Simple Axis Direction01¶

Simple Axis Direction03

Simple Axis Direction03¶

Simple Axis Pad

Simple Axis Pad¶

Simple Axisartist1

Simple Axisartist1¶

Simple Axisline

Simple Axisline¶

Simple Axisline2

Simple Axisline2¶

Simple Axisline3

Simple Axisline3¶

Showcase¶

Anatomy of a figure

Anatomy of a figure¶

Bachelor's degrees by gender

Bachelor's degrees by gender¶

Firefox

Firefox¶

Integral as the area under a curve

Integral as the area under a curve¶

Shaded & power normalized rendering

Shaded & power normalized rendering¶

XKCD

XKCD¶

Animation¶

Decay

Decay¶

Animated histogram

Animated histogram¶

pyplot animation

pyplot animation¶

The Bayes update

The Bayes update¶

The double pendulum problem

The double pendulum problem¶

Animated image using a precomputed list of images

Animated image using a precomputed list of images¶

Frame grabbing

Frame grabbing¶

Rain simulation

Rain simulation¶

Animated 3D random walk

Animated 3D random walk¶

Animated line plot

Animated line plot¶

Oscilloscope

Oscilloscope¶

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¶

Coords demo

Coords demo¶

Data Browser

Data Browser¶

Figure Axes Enter Leave

Figure Axes Enter Leave¶

Interactive functions

Interactive functions¶

Image Slices Viewer

Image Slices Viewer¶

Keypress Demo

Keypress Demo¶

Lasso Demo

Lasso Demo¶

Legend Picking

Legend Picking¶

Looking Glass

Looking Glass¶

Path Editor

Path Editor¶

Pick Event Demo

Pick Event Demo¶

Pick Event Demo2

Pick Event Demo2¶

Pipong

Pipong¶

Poly Editor

Poly Editor¶

Pong

Pong¶

Resampling Data

Resampling Data¶

Timers

Timers¶

Trifinder Event Demo

Trifinder Event Demo¶

Viewlims

Viewlims¶

Zoom Window

Zoom Window¶

Front Page¶

Frontpage 3D example

Frontpage 3D example¶

Frontpage contour example

Frontpage contour example¶

Frontpage histogram example

Frontpage histogram example¶

Frontpage plot example

Frontpage plot example¶

Miscellaneous¶

Agg Buffer

Agg Buffer¶

Agg Buffer To Array

Agg Buffer To Array¶

Anchored Artists

Anchored Artists¶

Changing colors of lines intersecting a box

Changing colors of lines intersecting a box¶

Manual Contour

Manual Contour¶

Coords Report

Coords Report¶

Cross hair cursor

Cross hair cursor¶

Custom projection

Custom projection¶

Customize Rc

Customize Rc¶

Demo Agg Filter

Demo Agg Filter¶

Ribbon Box

Ribbon Box¶

Fill Spiral

Fill Spiral¶

Findobj Demo

Findobj Demo¶

Font indexing

Font indexing¶

Font properties

Font properties¶

Building histograms using Rectangles and PolyCollections

Building histograms using Rectangles and PolyCollections¶

Hyperlinks

Hyperlinks¶

Image Thumbnail

Image Thumbnail¶

Plotting with keywords

Plotting with keywords¶

Load converter

Load converter¶

Matplotlib logo

Matplotlib logo¶

Multipage PDF

Multipage PDF¶

Multiprocess

Multiprocess¶

Patheffect Demo

Patheffect Demo¶

Print Stdout

Print Stdout¶

Pythonic Matplotlib

Pythonic Matplotlib¶

Rasterization Demo

Rasterization Demo¶

Set and get properties

Set and get properties¶

SVG Filter Line

SVG Filter Line¶

SVG Filter Pie

SVG Filter Pie¶

Table Demo

Table Demo¶

transforms.offset_copy

transforms.offset_copy¶

Zorder Demo

Zorder Demo¶

3D plotting¶

Plot 2D data on 3D plot

Plot 2D data on 3D plot¶

Demo of 3D bar charts

Demo of 3D bar charts¶

Create 2D bar graphs in different planes

Create 2D bar graphs in different planes¶

Demonstrates plotting contour (level) curves in 3D

Demonstrates plotting contour (level) curves in 3D¶

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

Demonstrates plotting contour (level) curves in 3D using the extend3d option¶

Projecting contour profiles onto a graph

Projecting contour profiles onto a graph¶

Filled contours

Filled contours¶

Projecting filled contour onto a graph

Projecting filled contour onto a graph¶

Custom hillshading in a 3D surface plot

Custom hillshading in a 3D surface plot¶

Create 3D histogram of 2D data

Create 3D histogram of 2D data¶

Parametric Curve

Parametric Curve¶

Lorenz Attractor

Lorenz Attractor¶

2D and 3D *Axes* in same *Figure*

2D and 3D Axes in same Figure¶

Automatic Text Offsetting

Automatic Text Offsetting¶

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¶

3D quiver plot

3D quiver plot¶

Rotating a 3D plot

Rotating a 3D plot¶

3D scatterplot

3D scatterplot¶

3D plots as subplots

3D plots as subplots¶

3D surface (color map)

3D surface (color map)¶

3D surface (solid color)

3D surface (solid color)¶

3D surface (checkerboard)

3D surface (checkerboard)¶

3D surface with polar coordinates

3D surface with polar coordinates¶

Text annotations in 3D

Text annotations in 3D¶

Triangular 3D contour plot

Triangular 3D contour plot¶

Triangular 3D filled contour plot

Triangular 3D filled contour plot¶

Triangular 3D surfaces

Triangular 3D surfaces¶

More triangular 3D surfaces

More triangular 3D surfaces¶

3D voxel / volumetric plot

3D voxel / volumetric plot¶

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 cylindrical coordinates

3D voxel / volumetric plot with cylindrical coordinates¶

3D wireframe plot

3D wireframe plot¶

Rotating 3D wireframe plot

Rotating 3D wireframe plot¶

3D wireframe plots in one direction

3D wireframe plots in one direction¶

Our Favorite Recipes¶

Here is a collection of short tutorials, examples and code snippets that illustrate some of the useful idioms and tricks to make snazzier figures and overcome some matplotlib warts.

Centered spines with arrows

Centered spines with arrows¶

Fixing common date annoyances

Fixing common date annoyances¶

Easily creating subplots

Easily creating subplots¶

Fill Between and Alpha

Fill Between and Alpha¶

Placing text boxes

Placing text boxes¶

Sharing axis limits and views

Sharing axis limits and views¶

Scales¶

These examples cover how different scales are handled in Matplotlib.

Loglog Aspect

Loglog Aspect¶

Custom scale

Custom scale¶

Log Bar

Log Bar¶

Log Demo

Log Demo¶

Log Axis

Log Axis¶

Logit Demo

Logit Demo¶

Exploring normalizations

Exploring normalizations¶

Scales

Scales¶

Symlog Demo

Symlog Demo¶

Specialty Plots¶

Hillshading

Hillshading¶

Anscombe's quartet

Anscombe's quartet¶

Hinton diagrams

Hinton diagrams¶

Left ventricle bullseye

Left ventricle bullseye¶

===

MRI¶

MRI With EEG

MRI With EEG¶

Radar chart (aka spider or star chart)

Radar chart (aka spider or star chart)¶

The Sankey class

The Sankey class¶

Long chain of connections using Sankey

Long chain of connections using Sankey¶

Rankine power cycle

Rankine power cycle¶

SkewT-logP diagram: using transforms and custom projections

SkewT-logP diagram: using transforms and custom projections¶

Topographic hillshading

Topographic hillshading¶

Ticks and spines¶

Automatically setting tick labels

Automatically setting tick labels¶

Centering labels between ticks

Centering labels between ticks¶

Colorbar Tick Labelling Demo

Colorbar Tick Labelling Demo¶

Custom Ticker1

Custom Ticker1¶

Formatting date ticks using ConciseDateFormatter

Formatting date ticks using ConciseDateFormatter¶

Date Demo Convert

Date Demo Convert¶

Date Demo Rrule

Date Demo Rrule¶

Date Index Formatter

Date Index Formatter¶

Date Precision and Epochs

Date Precision and Epochs¶

Major and minor ticks

Major and minor ticks¶

Multiple Yaxis With Spines

Multiple Yaxis With Spines¶

The default tick formatter

The default tick formatter¶

Spine Placement Demo

Spine Placement Demo¶

Spines

Spines¶

Custom spine bounds

Custom spine bounds¶

Dropped spines

Dropped spines¶

Tick formatters

Tick formatters¶

Tick locators

Tick locators¶

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¶

Set default x-axis tick labels on the top

Set default x-axis tick labels on the top¶

Rotating custom tick labels

Rotating custom tick labels¶

Units¶

These examples cover the many representations of units in Matplotlib.

Annotation with units

Annotation with units¶

Artist tests

Artist tests¶

Bar demo with units

Bar demo with units¶

Group barchart with units

Group barchart with units¶

Basic Units

Basic Units¶

Ellipse With Units

Ellipse With Units¶

Evans test

Evans test¶

Radian ticks

Radian ticks¶

Inches and Centimeters

Inches and Centimeters¶

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 wxpython, pygtk, tkinter and pyqt4/5.

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

CanvasAgg demo

CanvasAgg demo¶

Embedding in GTK3 with a navigation toolbar

Embedding in GTK3 with a navigation toolbar¶

Embedding in GTK3

Embedding in GTK3¶

Embedding in Qt

Embedding in Qt¶

Embedding in Tk

Embedding in Tk¶

Embedding in wx #2

Embedding in wx #2¶

Embedding in wx #3

Embedding in wx #3¶

Embedding in wx #4

Embedding in wx #4¶

Embedding in wx #5

Embedding in wx #5¶

Embedding WebAgg

Embedding WebAgg¶

Fourier Demo WX

Fourier Demo WX¶

GTK Spreadsheet

GTK Spreadsheet¶

MathText WX

MathText WX¶

Matplotlib With Glade 3

Matplotlib With Glade 3¶

pyplot with GTK

pyplot with GTK¶

SVG Histogram

SVG Histogram¶

SVG Tooltip

SVG Tooltip¶

Tool Manager

Tool Manager¶

WXcursor Demo

WXcursor Demo¶

Userdemo¶

Anchored Box01

Anchored Box01¶

Anchored Box02

Anchored Box02¶

Anchored Box03

Anchored Box03¶

Anchored Box04

Anchored Box04¶

Annotate Explain

Annotate Explain¶

Annotate Simple01

Annotate Simple01¶

Annotate Simple02

Annotate Simple02¶

Annotate Simple03

Annotate Simple03¶

Annotate Simple04

Annotate Simple04¶

Annotate Simple Coord01

Annotate Simple Coord01¶

Annotate Simple Coord02

Annotate Simple Coord02¶

Annotate Simple Coord03

Annotate Simple Coord03¶

Annotate Text Arrow

Annotate Text Arrow¶

Colormap Normalizations

Colormap Normalizations¶

Colormap Normalizations Symlognorm

Colormap Normalizations Symlognorm¶

Connect Simple01

Connect Simple01¶

Connectionstyle Demo

Connectionstyle Demo¶

Custom box styles

Custom box styles¶

subplot2grid demo

subplot2grid demo¶

GridSpec demo

GridSpec demo¶

Nested GridSpecs

Nested GridSpecs¶

Pgf Fonts

Pgf Fonts¶

Pgf Preamble

Pgf Preamble¶

Pgf Texsystem

Pgf Texsystem¶

Simple Annotate01

Simple Annotate01¶

Simple Legend01

Simple Legend01¶

Simple Legend02

Simple Legend02¶

Widgets¶

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

Buttons

Buttons¶

Check Buttons

Check Buttons¶

Cursor

Cursor¶

Lasso Selector Demo

Lasso Selector Demo¶

Menu

Menu¶

Multicursor

Multicursor¶

Polygon Selector Demo

Polygon Selector Demo¶

Radio Buttons

Radio Buttons¶

Rectangle Selector

Rectangle Selector¶

Slider Demo

Slider Demo¶

Span Selector

Span Selector¶

Textbox

Textbox¶

Download all examples in Python source code: gallery_python.zip
Download all examples in Jupyter notebooks: gallery_jupyter.zip

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2020 The Matplotlib development team.
Last updated on Nov 12, 2020. Created using Sphinx 3.1.1. Doc version v3.3.3-2-g447bdbbf58.