Skip to main content
Ctrl+K
Matplotlib 3.12.0.dev229+g1e6bcafd1 documentation - Home Matplotlib 3.12.0.dev229+g1e6bcafd1 documentation - Home
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub

Section Navigation

  • Lines, bars and markers
    • Line plot
    • Linestyles
    • Dashed line style configuration
    • Markevery Demo
    • JoinStyle
    • CapStyle
    • Marker reference
    • Infinite lines
    • Multicolored lines
    • Lines with a ticked patheffect
    • Grouped bar chart with labels
    • Bar chart with labels
    • Stacked bar chart
    • Bar chart with individual bar colors
    • Hat graph
    • Bar chart with gradients
    • Horizontal bar chart
    • Discrete distribution as horizontal bar chart
    • Broken horizontal bars
    • Scatter Demo2
    • Mapping marker properties to multivariate data
    • Marker examples
    • Scatter plot with a legend
    • Scatter plot with masked values
    • Scatter plot with histograms
    • Stairs Demo
    • Step Demo
    • Filled polygon
    • fill_between with transparency
    • Fill the area between two lines
    • Fill the area between two vertical lines
    • Stackplots and streamgraphs
    • EventCollection Demo
    • Eventplot demo
    • Timeline with lines, dates, and text
    • hlines and vlines
    • Shade regions defined by a logical mask using fill_between
    • Stem plot
    • Errorbar limit selection
    • Errorbar subsampling
    • Plotting categorical variables
    • Plotting masked and NaN values
    • Curve with error band
    • Spectrum representations
  • Images, contours and fields
    • Many ways to plot images
    • Image with masked values
    • Multiple images with one colorbar
    • Modifying the coordinate formatter
    • Image resampling
    • Interpolations for imshow
    • Layer images with alpha blending
    • Blend transparency with color in 2D images
    • Shading example
    • Clipping images with patches
    • Placing images, preserving relative sizes
    • pcolor images
    • pcolormesh
    • pcolormesh grids and shading
    • Image nonuniform
    • QuadMesh Demo
    • Triplot Demo
    • Tripcolor Demo
    • Tricontour Demo
    • Tricontour Smooth User
    • Tricontour Smooth Delaunay
    • Trigradient Demo
    • Triinterp Demo
    • Contour plot of irregularly spaced data
    • Contour Demo
    • Contour Label Demo
    • Contourf demo
    • Contour image
    • Contourf and log color scale
    • Contourf hatching
    • Contour corner mask
    • Contouring the solution space of optimizations
    • Quiver Simple Demo
    • Advanced quiver and quiverkey functions
    • Wind barbs
    • Streamplot
    • Interactive adjustment of colormap range
    • Colormap normalizations
    • Colormap normalizations SymLogNorm
    • Annotated heatmap
    • Affine transform of an image
    • Visualize matrices with matshow
    • Spy Demos
    • Spectrogram
    • Barcode
    • BboxImage Demo
    • Figimage Demo
    • Watermark image
  • Statistics
    • Errorbar function
    • Different ways of specifying error bars
    • Including upper and lower limits in error bars
    • Create boxes from error bars using PatchCollection
    • Plot a confidence ellipse of a two-dimensional dataset
    • Histograms
    • Demo of the histogram function's different histtype settings
    • Histogram bins, density, and weight
    • The histogram (hist) function with multiple data sets
    • Multiple histograms side by side
    • Bihistogram
    • Cumulative distributions
    • Hexagonal binned plot
    • Time Series Histogram
    • Boxplots
    • Artist customization in box plots
    • Box plots with custom fill colors
    • Separate calculation and plotting of boxplots
    • Box plot vs. violin plot comparison
    • Violin plot basics
    • Violin plot customization
    • Cross- and auto-correlation
    • Power spectral density (PSD)
    • Cross spectral density (CSD)
    • Plotting the coherence of two signals
  • Pie and polar charts
    • Pie charts
    • Bar of pie
    • Nested pie charts
    • A pie and a donut with labels
    • Labeling pie charts
    • Bar chart on polar axis
    • Polar plot
    • Error bar rendering on polar axis
    • Polar legend
    • Scatter plot on polar axis
  • Subplots, axes and figures
    • Multiple subplots
    • Create multiple subplots using plt.subplots
    • Axes Demo
    • GridSpec with variable sizes and spacing
    • Gridspec for multi-column/row subplot layouts
    • Nested Gridspecs
    • Combine two subplots using subplots and GridSpec
    • subplot2grid
    • Resize Axes with constrained layout
    • Resize Axes with tight layout
    • Subplots spacings and margins
    • Programmatically control subplot adjustment
    • Adjacent subplots
    • Controlling view limits using margins and sticky_edges
    • Axes box aspect
    • Equal axis aspect ratio
    • Manage multiple figures in pyplot
    • Figure size in different units
    • Figure subfigures
    • Custom Figure subclasses
    • Shared axis
    • Inverted axis
    • Plots with different scales
    • Different scales on the same Axes
    • Multiple y-axis with Spines
    • Twin Axes with delta_zorder
    • Secondary Axis
    • Align labels and titles
    • Axis label position
    • Axes properties
    • Figure labels: suptitle, supxlabel, supylabel
    • Axes zoom effect
    • Zoom region inset Axes
    • Broken axis
    • Geographic Projections
    • Draw regions that span an Axes
  • Ticks
    • Automatically setting tick positions
    • Tick locators
    • Major and minor ticks
    • Align tick labels
    • Move x/y-axis ticks and labels on top and right
    • Center labels between ticks
    • Rotated tick labels
    • Multilevel (nested) ticks
    • The default tick formatter
    • Tick formatters
    • Custom Ticker
    • Dollar ticks
    • Format ticks using engineering notation
    • SI prefixed offsets and natural order of magnitudes
    • Setting tick labels from a list of values
    • Date tick labels
    • Date tick locators and formatters
    • Format date ticks using ConciseDateFormatter
    • Date converter demo
    • Placing date ticks using recurrence rules
    • Custom tick formatter for time series
    • Date precision and epochs
    • Colorbar Tick labelling
    • Customizing figure and axes appearance
    • Fixing too many ticks
  • Scales
    • Scales overview
    • Asinh scale
    • Loglog aspect
    • Custom scale
    • Log scale
    • Logit scale
    • Exploring normalizations
    • Symlog scale
  • Spines
    • Spines
    • Spine placement
    • Dropped spines
    • Centered spines with arrows
  • Text, labels and annotations
    • Text properties
    • Controlling style of text and labels using a dictionary
    • Text alignment
    • Multiline text
    • Auto-wrap text
    • Text rotation mode
    • Text rotation angle in data coordinates
    • Concatenate text objects with different properties
    • Using a text as a Path
    • Annotating a plot
    • Annotate plots
    • Annotate polar plots
    • Angle annotations on bracket arrows
    • Annotation arrow style reference
    • Styling text boxes
    • Placing text boxes
    • Labelling subplots
    • Artists as annotations
    • Arrow Demo
    • Scale invariant angle label
    • Legend Demo
    • Legend using pre-defined labels
    • Compose custom legends
    • Figure legend demo
    • Accented text
    • The difference between \dfrac and \frac
    • Configure the font family
    • Using ttf font files
    • Font table
    • Fonts demo (object-oriented style)
    • Fonts demo (keyword arguments)
    • Convert texts to images
    • Mathtext
    • Mathematical expressions
    • Math fontfamily
    • STIX Fonts
    • Render math equations using TeX
    • Unicode minus
    • Usetex text baseline
    • Usetex font effects
    • Artist within an artist
    • Title positioning
    • Text watermark
  • Shapes and collections
    • Arrow guide
    • Reference for Matplotlib artists
    • Line, Poly and RegularPoly Collection
    • Compound path
    • Dolphins
    • Mmh Donuts!!!
    • Ellipse with orientation arrow demo
    • Ellipse Collection
    • Ellipse Demo
    • Drawing fancy boxes
    • Hatch demo
    • Hatch style reference
    • Hatchcolor Demo
    • Plot multiple lines using a LineCollection
    • Circles, Wedges and Polygons
    • PathPatch object
    • Bezier curve
    • Scatter plot
  • Color
    • Color Demo
    • Color by y-value
    • Colors in the default property cycle
    • Named color sequences
    • Colorbar
    • Histogram as colorbar
    • Colormap reference
    • Create a colormap from a list of colors
    • Selecting individual colors from a colormap
    • List of named colors
    • Ways to set a color's alpha value
  • Style sheets
    • Bayesian Methods for Hackers style sheet
    • Dark background style sheet
    • FiveThirtyEight style sheet
    • ggplot style sheet
    • Grayscale style sheet
    • Petroff style sheets
    • Solarized Light stylesheet
    • Style sheets reference
  • Module - pyplot
    • Basic plot
    • Two subplots using pyplot
  • 3D plotting
    • Plot 2D data on 3D plot
    • Demo of 3D bar charts
    • Clip the data to the axes view limits
    • Create 2D bar graphs in different planes
    • 3D box surface plot
    • Plot contour (level) curves in 3D
    • Plot contour (level) curves in 3D using the extend3d option
    • Project contour profiles onto a graph
    • Filled contours
    • Project filled contour onto a graph
    • Custom hillshading in a 3D surface plot
    • 3D errorbars
    • Fill between 3D lines
    • Fill under 3D line graphs
    • Create 3D histogram of 2D data
    • 2D images in 3D
    • Intersecting planes
    • Parametric curve
    • Lorenz attractor
    • 2D and 3D Axes in same figure
    • Automatic text offsetting
    • Draw flat objects in 3D plot
    • Generate 3D polygons
    • 3D plot projection types
    • 3D quiver plot
    • Rotating a 3D plot
    • Scales on 3D (Log, Symlog, etc.)
    • 3D scatterplot
    • 3D stem
    • 3D plots as subplots
    • 3D surface (colormap)
    • 3D surface (solid color)
    • 3D surface (checkerboard)
    • 3D surface with polar coordinates
    • Text annotations in 3D
    • Triangular 3D contour plot
    • Triangular 3D filled contour plot
    • Triangular 3D surfaces
    • More triangular 3D surfaces
    • Primary 3D view planes
    • 3D voxel / volumetric plot
    • 3D voxel plot of the NumPy logo
    • 3D voxel / volumetric plot with RGB colors
    • 3D voxel / volumetric plot with cylindrical coordinates
    • 3D wireframe plot
    • Animate a 3D wireframe plot
    • 3D wireframe plots in one direction
  • Module - axes_grid1
    • Anchored Direction Arrow
    • Axes divider
    • Demo Axes Grid
    • Axes Grid2
    • HBoxDivider and VBoxDivider demo
    • Show RGB channels using RGBAxes
    • Colorbar with AxesDivider
    • Control the position and size of a colorbar with inset_locator.inset_axes
    • Per-row or per-column colorbars
    • Axes with a fixed physical size
    • ImageGrid cells with a fixed aspect ratio
    • Inset locator demo
    • Inset locator demo 2
    • Make room for ylabel using axes_grid
    • Parasite Simple
    • Parasite Simple2
    • Align histogram to scatter plot using locatable Axes
    • Simple Anchored Artists
    • Simple Axes Divider 1
    • Simple axes divider 3
    • Simple ImageGrid
    • Simple ImageGrid 2
    • Simple Axisline4
  • Module - axisartist
    • Axis Direction
    • axis_direction demo
    • Axis line styles
    • Curvilinear grid demo
    • Demo CurveLinear Grid2
    • floating_axes features
    • floating_axis demo
    • Parasite Axes demo
    • Parasite axis demo
    • Ticklabel alignment
    • Ticklabel direction
    • Simple axis direction
    • Simple axis tick label and tick directions
    • Simple axis pad
    • Custom spines with axisartist
    • Simple Axisline
    • Simple Axisline3
  • Animation
    • Basic animated line plot
    • Decay
    • Animated histogram
    • pyplot animation
    • The Bayes update
    • The double pendulum problem
    • Animated image using a precomputed list of images
    • Frame grabbing
    • Multiple Axes animation
    • Pause and resume an animation
    • Rain simulation
    • Animated 3D random walk
    • Animated scatter saved as GIF
    • Oscilloscope
    • Matplotlib unchained
  • Widgets
    • Annotated cursor
    • Buttons
    • Check buttons
    • Cursor
    • Lasso Selector
    • Menu
    • Mouse Cursor
    • Multicursor
    • Select indices from a collection using polygon selector
    • Polygon Selector
    • Radio Buttons
    • Radio Buttons Grid
    • Image scaling using a RangeSlider
    • Rectangle and ellipse selectors
    • Slider
    • Snap sliders to discrete values
    • Span Selector
    • Textbox
  • Event handling
    • Close event
    • Mouse move and click events
    • Cross-hair cursor
    • Data browser
    • Figure/Axes enter and leave events
    • Interactive functions
    • Scroll event
    • Keypress event
    • Lasso Demo
    • Legend picking
    • Looking glass
    • Path editor
    • Pick event demo
    • Pick event demo 2
    • Polygon editor
    • Pong
    • Resampling Data
    • Timers
    • Trifinder Event Demo
    • Viewlims
    • Zoom modifies other Axes
  • Embedding Matplotlib in graphical user interfaces
    • CanvasAgg demo
    • Embed in GTK3 with a navigation toolbar
    • Embed in GTK3
    • Embed in GTK4 with a navigation toolbar
    • Embed in GTK4
    • Embed in Qt
    • Embed in Tk
    • Embed in wx #2
    • Embed in wx #3
    • Embed in wx #4
    • Embed in wx #5
    • Embedding WebAgg
    • Fourier Demo WX
    • GTK3 spreadsheet
    • GTK4 spreadsheet
    • Display mathtext in WX
    • Matplotlib with Glade 3
    • mplcvd -- an example of figure hook
    • pyplot with GTK3
    • pyplot with GTK4
    • SVG Histogram
    • SVG Tooltip
    • Tool Manager
    • Embed in a web application server (Flask)
    • Add a cursor in WX
  • Units
    • Annotation with units
    • Artist tests
    • Bar demo with units
    • Group barchart with units
    • Basic units
    • Ellipse with units
    • Evans test
    • Radian ticks
    • Inches and centimeters
    • Unit handling
  • Miscellaneous
    • Anchored Artists
    • Identify whether artists intersect
    • Manual Contour
    • Coords Report
    • Custom projection
    • Customize Rc
    • AGG filter
    • Ribbon box
    • Add lines directly to a figure
    • Fill spiral
    • Findobj Demo
    • Font indexing
    • Font properties
    • Building histograms using Rectangles and PolyCollections
    • Hyperlinks
    • Plotting with keywords
    • Matplotlib logo
    • Multipage PDF
    • Multiprocessing
    • Packed-bubble chart
    • Patheffect Demo
    • Print image to stdout
    • Rasterization for vector graphics
    • Set and get properties
    • Apply SVG filter to a line
    • SVG filter pie
    • Table Demo
    • TickedStroke patheffect
    • transforms.offset_copy
    • Zorder Demo
  • Showcase
    • Anatomy of a figure
    • Firefox
    • Integral as the area under a curve
    • Shaded & power normalized rendering
    • Pan/zoom events of overlapping axes
    • Stock prices over 32 years
    • XKCD
  • Specialty plots
    • Hillshading
    • Anscombe's quartet
    • Hinton diagrams
    • Ishikawa Diagram
    • Left ventricle bullseye
    • MRI with EEG
    • Radar chart (aka spider or star chart)
    • The Sankey class
    • Long chain of connections using Sankey
    • Rankine power cycle
    • SkewT-logP diagram: using transforms and custom projections
    • Topographic hillshading
  • Examples
  • Units

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

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2026 The Matplotlib development team.

Created using Sphinx 9.1.0.

Built from v3.11.0rc2-229-g1e6bcafd1.

Built with the PyData Sphinx Theme 0.18.0.