点击下载 OpenCV最新中文官方文档pdf版
目录
Lines, bars and markers
- Stacked Bar Graph
- Grouped bar chart with labels
- Horizontal bar chart
- Broken Barh
- Plotting categorical variables
- Plotting the coherence of two signals
- CSD Demo
- Errorbar limit selection
- Errorbar Subsample
- EventCollection Demo
- Eventplot Demo
- Filled polygon
- Filling the area between lines
- Fill Betweenx Demo
- Hatch-filled histograms
- Bar chart with gradients
- Discrete distribution as horizontal bar chart
- Join styles and cap styles
- Customizing dashed line styles
- Linestyles
- Marker filling-styles
- Marker Reference
- Markevery Demo
- prop_cycle property markevery in rcParams
- Masked Demo
- Multicolored lines
- Nan Test
- Psd Demo
- Scatter Custom Symbol
- Scatter Demo2
- Scatter plot with histograms
- Scatter Masked
- Scatter plot with pie chart markers
- Scatter Star Poly
- Scatter Symbol
- Scatter plots with a legend
- Simple Plot
- Using span_where
- Spectrum Representations
- Stackplot Demo
- Stem Plot
- Step Demo
- Creating a timeline with lines, dates, and text
- hlines and vlines
- Cross- and Auto-Correlation Demo
Images, contours and fields
- Affine transform of an image
- Barb Demo
- Barcode Demo
- Contour Corner Mask
- Contour Demo
- Contour Image
- Contour Label Demo
- Contourf Demo
- Contourf Hatching
- Contourf and log color scale
- BboxImage Demo
- Figimage Demo
- Creating annotated heatmaps
- Clipping images with patches
- Image Demo
- Image Masked
- Image Nonuniform
- Blend transparency with color in 2-D images
- Modifying the coordinate formatter
- Interpolations for imshow/matshow
- Contour plot of irregularly spaced data
- Layer Images
- Matshow
- Multi Image
- Pcolor Demo
- pcolormesh
- Streamplot
- QuadMesh Demo
- Advanced quiver and quiverkey functions
- Quiver Simple Demo
- Shading example
- Spectrogram Demo
- Spy Demos
- Tricontour Demo
- Tricontour Smooth Delaunay
- Tricontour Smooth User
- Trigradient Demo
- Triinterp Demo
- Tripcolor Demo
- Triplot Demo
- Watermark image
Subplots, axes and figures
- Aligning Labels
- Axes Demo
- Zooming in and out using Axes.margins and the subject of "stickiness"
- Axes Props
- Axes Zoom Effect
- axhspan Demo
- Axis Equal Demo
- Broken Axis
- Placing Colorbars
- Custom Figure Class
- Resizing axes with constrained layout
- Resizing axes with tight layout
- Different scales on the same axes
- Figure Title
- Creating adjacent subplots
- Geographic Projections
- Combining two subplots using subplots and GridSpec
- Using Gridspec to make multi-column/row subplot layouts
- Nested Gridspecs
- Invert Axes
- Multiple Figs Demo
- Secondary Axis
- Shared Axis Demo
- Multiple subplots
- Basic Subplot Demo
- Subplot Toolbar
- Subplots Adjust
- Creating multiple subplots using plt.subplots
- Plots with different scales
- Zoom region inset axes
Statistics
- Box plots with custom fill colors
- Boxplots
- Box plot vs. violin plot comparison
- Boxplot drawer function
- Plot a confidence ellipse of a two-dimensional dataset
- Violin plot customization
- Errorbar function
- Different ways of specifying error bars
- Including upper and lower limits in error bars
- Creating boxes from error bars using PatchCollection
- Hexbin Demo
- Histograms
- Using histograms to plot a cumulative distribution
- Demo of the histogram (hist) function with a few features
- Demo of the histogram function's different histtype settings
- The histogram (hist) function with multiple data sets
- Producing multiple histograms side by side
- Violin plot basics
Pie and polar charts
- Basic pie chart
- Pie Demo2
- Bar of pie
- Nested pie charts
- Labeling a pie and a donut
- Bar chart on polar axis
- Polar Demo
- Polar Legend
- Scatter plot on polar axis
Text, labels and annotations
- Using accented text in matplotlib
- Annotating Plots
- Arrow Demo
- Arrow Simple Demo
- Auto-wrapping text
- Composing Custom Legends
- Dashpoint Label
- Date tick labels
- Custom tick formatter for time series
- Demo Annotation Box
- Demo Text Path
- Demo Text Rotation Mode
- The difference between \dfrac and \frac
- Labeling ticks using engineering notation
- Fancyarrow Demo
- Fancytextbox Demo
- Figure legend demo
- Configuring the font family
- Using a ttf font file in Matplotlib
- Font table
- Fonts demo (object-oriented style)
- Fonts demo (kwargs)
- Legend using pre-defined labels
- Legend Demo
- Artist within an artist
- A mathtext image as numpy array
- Mathtext Demo
- Mathtext Examples
- Multiline
- Rainbow text
- STIX Fonts Demo
- Rendering math equation using TeX
- Precise text layout
- Controlling style of text and labels using a dictionary
- Default text rotation demonstration
- Text Rotation Relative To Line
- Titles Demo
- Unicode minus
- Usetex Baseline Test
- Usetex Demo
- Usetex Fonteffects
- Text watermark
Pyplot
- Align y-labels
- Annotate Transform
- Annotating a plot
- Annotation Polar
- Auto Subplots Adjust
- Boxplot Demo
- Dollar Ticks
- Fig Axes Customize Simple
- Simple axes labels
- Adding lines to figures
- plot() format string
- Pyplot Mathtext
- Pyplot Scales
- Pyplot Simple
- Pyplot Text
- Pyplot Three
- Pyplot Two Subplots
- Text Commands
- Text Layout
- Whats New 1 Subplot3d
- Whats New 0.98.4 Fancy
- Whats New 0.99 Axes Grid
- Whats New 0.99 Mplot3d
- Whats 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 by y-value
- Colors in the default property cycle
- Styling with cycler
- Colorbar
- Colormap reference
- Creating a colormap from a list of colors
- List of named colors
Shapes and collections
- Arrow guide
- Reference for Matplotlib artists
- Line, Poly and RegularPoly Collection with autoscaling
- Compound path
- Dolphins
- Mmh Donuts!!!
- Ellipse Collection
- Ellipse Demo
- Fancybox Demo
- Hatch Demo
- Line Collection
- Marker Path
- Circles, Wedges and Polygons
- PathPatch object
Style sheets
- Bayesian Methods for Hackers style sheet
- Dark background style sheet
- FiveThirtyEight style sheet
- ggplot style sheet
- Grayscale style sheet
Axes Grid
- Demo Anchored Direction Arrow
- Demo Axes Divider
- Demo Axes Grid
- Demo Axes Grid2
- Demo Axes Hbox Divider
- Demo Axes RGB
- Demo Colorbar of Inset Axes
- Demo Colorbar with Axes Divider
- Controlling the position and size of colorbars with Inset Axes
- Demo Edge Colorbar
- Demo Fixed Size Axes
- Demo Imagegrid Aspect
- Inset Locator Demo
- Inset Locator Demo2
- Make Room For Ylabel Using Axesgrid
- Parasite Simple
- Parasite Simple2
- Scatter Hist
- Simple Anchored Artists
- Simple Axes Divider 1
- Simple Axes Divider 2
- Simple Axes Divider 3
- Simple ImageGrid
- Simple ImageGrid 2
- Simple Axisline4
Axis Artist
- Axis Direction Demo Step01
- Axis Direction Demo Step02
- Axis Direction Demo Step03
- Axis Direction Demo Step04
- Demo Axis Direction
- Axis line styles
- Curvilinear grid demo
- Demo Curvelinear Grid2
- mpl_toolkits.axisartist.floating_axes features
- Demo Floating Axis
- Parasite Axes demo
- Demo Parasite Axes2
- Demo Ticklabel Alignment
- Demo Ticklabel Direction
- Simple Axis Direction01
- Simple Axis Direction03
- Simple Axis Pad
- Simple Axisartist1
- Simple Axisline
Showcase
Animation
- Decay
- Animated histogram
- pyplot animation
- The Bayes update
- The double pendulum problem
- Animated image using a precomputed list of images
- Frame grabbing
- Rain simulation
- Animated 3D random walk
- Animated line plot
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
- Coords demo
- Data Browser
- Figure Axes Enter Leave
- Interactive functions
- Image Slices Viewer
- Keypress Demo
- Lasso Demo
- Legend Picking
- Looking Glass
- Path Editor
- Pick Event Demo
- Pick Event Demo2
- Pipong
- Poly Editor
- Pong
- Resampling Data
- Timers
- Trifinder Event Demo
Front Page
Miscellaneous
- Agg Buffer
- Agg Buffer To Array
- Anchored Artists
- Changing colors of lines intersecting a box
- Manual Contour
- Coords Report
- Cursor Demo
- Custom projection
- Customize Rc
- Demo Agg Filter
- Ribbon Box
- Fill Spiral
- Findobj Demo
- Font indexing
- Font properties
- Building histograms using Rectangles and PolyCollections
- Hyperlinks
- Image Thumbnail
- Plotting with keywords
- Load converter
- Matplotlib logo
- Multipage PDF
- Multiprocess
- Patheffect Demo
- Plotfile Demo
- Print Stdout
- Pythonic Matplotlib
- Rasterization Demo
- Set And Get
- SVG Filter Line
- SVG Filter Pie
- Table Demo
3D plotting
- Plot 2D data on 3D plot
- Demo of 3D bar charts
- Create 2D bar graphs in different planes
- Demonstrates plotting contour (level) curves in 3D
- Demonstrates plotting contour (level) curves in 3D using the extend3d option
- Projecting contour profiles onto a graph
- Filled contours
- Projecting filled contour onto a graph
- Custom hillshading in a 3D surface plot
- Create 3D histogram of 2D data
- Parametric Curve
- Lorenz Attractor
- 2D and 3D Axes in same Figure
- Automatic Text Offsetting
- Draw flat objects in 3D plot
- Generate polygons to fill under 3D line graph
- 3D quiver plot
- Rotating a 3D plot
- 3D scatterplot
- 3D plots as subplots
- 3D surface (color map)
- 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
- 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
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.
Scales
These examples cover how different scales are handled in Matplotlib.
Specialty Plots
- Hillshading
- Anscombe's Quartet
- Hinton diagrams
- Left ventricle bullseye
- MRI
- MRI With EEG
- Radar chart (aka spider or star chart)
- The Sankey class
- Long chain of connections using Sankey
- Rankine power cycle
Ticks and spines
- Automatically setting tick labels
- Centering labels between ticks
- Colorbar Tick Labelling Demo
- Custom Ticker1
- Formatting date ticks using ConciseDateFormatter
- Date Demo Convert
- Date Demo Rrule
- Date Index Formatter
- Major and minor ticks
- Multiple Yaxis With Spines
- Tick formatting using the ScalarFormatter
- Spine Placement Demo
- Spines
- Custom spine bounds
- Dropped spines
- Tick formatters
- Tick locators
- Set default y-axis tick labels on the right
- Setting tick labels from a list of values
Units
These examples cover the many representations of units in Matplotlib.
- Annotation with units
- Artist tests
- Bar demo with units
- Group barchart with units
- Basic Units
- Ellipse With Units
- Evans test
- Radian ticks
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.
- CanvasAgg demo
- Embedding in GTK3 with a navigation toolbar
- Embedding in GTK3
- Embedding in Qt
- Embedding in Tk
- Embedding in wx #2
- Embedding in wx #3
- Embedding in wx #4
- Embedding in wx #5
- Embedding WebAgg
- Fourier Demo WX
- GTK Spreadsheet
- MathText WX
- Matplotlib With Glade 3
- pyplot with GTK
- SVG Histogram
- SVG Tooltip
Userdemo
- Anchored Box01
- Anchored Box02
- Anchored Box03
- Anchored Box04
- Annotate Explain
- Annotate Simple01
- Annotate Simple02
- Annotate Simple03
- Annotate Simple04
- Annotate Simple Coord01
- Annotate Simple Coord02
- Annotate Simple Coord03
- Annotate Text Arrow
- Colormap Normalizations
- Colormap Normalizations Bounds
- Colormap Normalizations Custom
- DivergingNorm colormap normalization
- Colormap Normalizations Lognorm
- Colormap Normalizations Power
- Colormap Normalizations Symlognorm
- Connect Simple01
- Connectionstyle Demo
- Custom Boxstyle01
- Custom Boxstyle02
- subplot2grid demo
- GridSpec demo
- Nested GridSpecs
- Pgf Fonts
- Pgf Preamble
- Pgf Texsystem
- Simple Annotate01
Widgets
Examples of how to write primitive, but GUI agnostic, widgets in matplotlib