Examples — Matplotlib 3.5.2 Documentation
Có thể bạn quan tâm
- Gitter
- Discourse
- GitHub
Section Navigation
- Lines, bars and markers
- Infinite lines
- Bar chart with individual bar colors
- Bar chart with labels
- Stacked bar chart
- Grouped bar chart with labels
- Horizontal bar chart
- Broken horizontal bars
- CapStyle
- Plotting categorical variables
- Plotting the coherence of two signals
- Cross spectral density (CSD)
- Curve with error band
- Errorbar limit selection
- Errorbar subsampling
- EventCollection Demo
- Eventplot demo
- Filled polygon
- fill_between with transparency
- Fill the area between two lines
- Fill the area between two vertical lines
- Bar chart with gradients
- Hat graph
- Discrete distribution as horizontal bar chart
- JoinStyle
- Dashed line style configuration
- Lines with a ticked patheffect
- Linestyles
- Marker reference
- Markevery Demo
- Plotting masked and NaN values
- Multicolored lines
- Mapping marker properties to multivariate data
- Power spectral density (PSD)
- Scatter Demo2
- Scatter plot with histograms
- Scatter plot with masked values
- Marker examples
- Scatter plot with a legend
- Line plot
- Shade regions defined by a logical mask using fill_between
- Spectrum representations
- Stackplots and streamgraphs
- Stairs Demo
- Stem plot
- Step Demo
- Timeline with lines, dates, and text
- hlines and vlines
- Cross- and auto-correlation
- Images, contours and fields
- Affine transform of an image
- Wind barbs
- Barcode
- Interactive adjustment of colormap range
- Colormap normalizations
- Colormap normalizations SymLogNorm
- Contour corner mask
- Contour Demo
- Contour image
- Contour Label Demo
- Contourf demo
- Contourf hatching
- Contourf and log color scale
- Contouring the solution space of optimizations
- BboxImage Demo
- Figimage Demo
- Annotated heatmap
- Image resampling
- Clipping images with patches
- Many ways to plot images
- Image with masked values
- Image nonuniform
- Blend transparency with color in 2D images
- Modifying the coordinate formatter
- Interpolations for imshow
- Contour plot of irregularly spaced data
- Layer images with alpha blending
- Visualize matrices with matshow
- Multiple images with one colorbar
- pcolor images
- pcolormesh grids and shading
- pcolormesh
- Streamplot
- QuadMesh Demo
- Advanced quiver and quiverkey functions
- Quiver Simple Demo
- Shading example
- Spectrogram
- Spy Demos
- Tricontour Demo
- Tricontour Smooth Delaunay
- Tricontour Smooth User
- Trigradient Demo
- Triinterp Demo
- Tripcolor Demo
- Triplot Demo
- Watermark image
- Subplots, axes and figures
- Align labels and titles
- Programmatically control subplot adjustment
- Axes box aspect
- Axes Demo
- Controlling view limits using margins and sticky_edges
- Axes properties
- Axes zoom effect
- Draw regions that span an Axes
- Equal axis aspect ratio
- Axis label position
- Broken axis
- Custom Figure subclasses
- Resize Axes with constrained layout
- Resize Axes with tight layout
- Different scales on the same Axes
- Figure size in different units
- Figure labels: suptitle, supxlabel, supylabel
- Adjacent subplots
- Geographic Projections
- Combine two subplots using subplots and GridSpec
- GridSpec with variable sizes and spacing
- Gridspec for multi-column/row subplot layouts
- Nested Gridspecs
- Inverted axis
- Manage multiple figures in pyplot
- Secondary Axis
- Share axis limits and views
- Shared axis
- Figure subfigures
- Multiple subplots
- subplot2grid
- Subplots spacings and margins
- Create multiple subplots using plt.subplots
- Plots with different scales
- Zoom region inset Axes
- Statistics
- Artist customization in box plots
- Box plots with custom fill colors
- Boxplots
- Box plot vs. violin plot comparison
- Separate calculation and plotting of boxplots
- 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
- Create boxes from error bars using PatchCollection
- Hexagonal binned plot
- Histograms
- Bihistogram
- Cumulative distributions
- Demo of the histogram function's different histtype settings
- The histogram (hist) function with multiple data sets
- Histogram bins, density, and weight
- Multiple histograms side by side
- Time Series Histogram
- Violin plot basics
- Pie and polar charts
- Pie charts
- Bar of pie
- Nested pie charts
- A pie and a donut with labels
- Bar chart on polar axis
- Polar plot
- Error bar rendering on polar axis
- Polar legend
- Scatter plot on polar axis
- Text, labels and annotations
- Accented text
- Align y-labels
- Scale invariant angle label
- Angle annotations on bracket arrows
- Annotate transform
- Annotating a plot
- Annotate plots
- Annotate polar plots
- Arrow Demo
- Auto-wrap text
- Compose custom legends
- Date tick labels
- AnnotationBbox demo
- Using a text as a Path
- Text rotation mode
- The difference between \dfrac and \frac
- Format ticks using engineering notation
- Annotation arrow style reference
- Styling text boxes
- Figure legend demo
- Configure the font family
- Using ttf font files
- Font table
- Fonts demo (object-oriented style)
- Fonts demo (keyword arguments)
- Labelling subplots
- Legend using pre-defined labels
- Legend Demo
- Artist within an artist
- Convert texts to images
- Mathtext
- Mathematical expressions
- Math fontfamily
- Multiline
- Placing text boxes
- Concatenate text objects with different properties
- STIX Fonts
- Render math equations using TeX
- Text alignment
- Text properties
- Controlling style of text and labels using a dictionary
- Text rotation angle in data coordinates
- Title positioning
- Unicode minus
- Usetex text baseline
- Usetex font effects
- Text watermark
- Color
- Color Demo
- Color by y-value
- Colors in the default property cycle
- Named color sequences
- 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
- Shapes and collections
- Arrow guide
- Reference for Matplotlib artists
- Line, Poly and RegularPoly Collection with autoscaling
- Compound path
- Dolphins
- Mmh Donuts!!!
- Ellipse with orientation arrow demo
- Ellipse Collection
- Ellipse Demo
- Drawing fancy boxes
- Hatch demo
- Hatch style reference
- Plot multiple lines using a LineCollection
- Circles, Wedges and Polygons
- PathPatch object
- Bezier curve
- Scatter plot
- Style sheets
- Bayesian Methods for Hackers style sheet
- Dark background style sheet
- FiveThirtyEight style sheet
- ggplot style sheet
- Grayscale style sheet
- Petroff10 style sheet
- Solarized Light stylesheet
- Style sheets reference
- Module - pyplot
- Simple plot
- Text and mathtext using pyplot
- Multiple lines using pyplot
- Two subplots using pyplot
- 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 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
- 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
- Animation
- 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 line plot
- Animated scatter saved as GIF
- Oscilloscope
- Matplotlib unchained
- 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
- 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
- Image thumbnail
- 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
- 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
- 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
- Scales
- Scales overview
- Asinh scale
- Loglog aspect
- Custom scale
- Log scale
- Logit scale
- Exploring normalizations
- Symlog scale
- 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
- Spines
- Spines
- Spine placement
- Dropped spines
- Multiple y-axis with Spines
- Centered spines with arrows
- Ticks
- Align tick labels
- Automatically setting tick positions
- Center labels between ticks
- Colorbar Tick Labelling
- Custom Ticker
- Format date ticks using ConciseDateFormatter
- Date Demo Convert
- Placing date ticks using recurrence rules
- Date tick locators and formatters
- Custom tick formatter for time series
- Date precision and epochs
- Dollar ticks
- SI prefixed offsets and natural order of magnitudes
- Fig Axes Customize Simple
- Major and minor ticks
- Multilevel (nested) ticks
- The default tick formatter
- Tick formatters
- Tick locators
- Set default y-axis tick labels on the right
- Setting tick labels from a list of values
- Move x-axis tick labels to the top
- Rotated tick labels
- Fixing too many ticks
- 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
- 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
- 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
- Image scaling using a RangeSlider
- Rectangle and ellipse selectors
- Slider
- Snap sliders to discrete values
- Span Selector
- Textbox
- Userdemo
- Nested GridSpecs
- Simple Legend01
- Simple Legend02
- Examples
For an overview of the plotting methods we provide, see Plot types
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.
Tagging!
You can also browse the example gallery by tags.
Lines, bars and markers#
Infinite lines
Infinite linesBar chart with individual bar colors
Bar chart with individual bar colorsBar chart with labels
Bar chart with labelsStacked bar chart
Stacked bar chartGrouped bar chart with labels
Grouped bar chart with labelsHorizontal bar chart
Horizontal bar chartBroken horizontal bars
Broken horizontal barsCapStyle
CapStylePlotting categorical variables
Plotting categorical variablesPlotting the coherence of two signals
Plotting the coherence of two signalsCross spectral density (CSD)
Cross spectral density (CSD)Curve with error band
Curve with error bandErrorbar limit selection
Errorbar limit selectionErrorbar subsampling
Errorbar subsamplingEventCollection Demo
EventCollection DemoEventplot demo
Eventplot demoFilled polygon
Filled polygonfill_between with transparency
fill_between with transparencyFill the area between two lines
Fill the area between two linesFill the area between two vertical lines
Fill the area between two vertical linesBar chart with gradients
Bar chart with gradientsHat graph
Hat graphDiscrete distribution as horizontal bar chart
Discrete distribution as horizontal bar chartJoinStyle
JoinStyleDashed line style configuration
Dashed line style configurationLines with a ticked patheffect
Lines with a ticked patheffectLinestyles
LinestylesMarker reference
Marker referenceMarkevery Demo
Markevery DemoPlotting masked and NaN values
Plotting masked and NaN valuesMulticolored lines
Multicolored linesMapping marker properties to multivariate data
Mapping marker properties to multivariate dataPower spectral density (PSD)
Power spectral density (PSD)Scatter Demo2
Scatter Demo2Scatter plot with histograms
Scatter plot with histogramsScatter plot with masked values
Scatter plot with masked valuesMarker examples
Marker examplesScatter plot with a legend
Scatter plot with a legendLine plot
Line plotShade regions defined by a logical mask using fill_between
Shade regions defined by a logical mask using fill_betweenSpectrum representations
Spectrum representationsStackplots and streamgraphs
Stackplots and streamgraphsStairs Demo
Stairs DemoStem plot
Stem plotStep Demo
Step DemoTimeline with lines, dates, and text
Timeline with lines, dates, and texthlines and vlines
hlines and vlinesCross- and auto-correlation
Cross- and auto-correlationImages, contours and fields#
Affine transform of an image
Affine transform of an imageWind barbs
Wind barbsBarcode
BarcodeInteractive adjustment of colormap range
Interactive adjustment of colormap rangeColormap normalizations
Colormap normalizationsColormap normalizations SymLogNorm
Colormap normalizations SymLogNormContour corner mask
Contour corner maskContour Demo
Contour DemoContour image
Contour imageContour Label Demo
Contour Label DemoContourf demo
Contourf demoContourf hatching
Contourf hatchingContourf and log color scale
Contourf and log color scaleContouring the solution space of optimizations
Contouring the solution space of optimizationsBboxImage Demo
BboxImage DemoFigimage Demo
Figimage DemoAnnotated heatmap
Annotated heatmapImage resampling
Image resamplingClipping images with patches
Clipping images with patchesMany ways to plot images
Many ways to plot imagesImage with masked values
Image with masked valuesImage nonuniform
Image nonuniformBlend transparency with color in 2D images
Blend transparency with color in 2D imagesModifying the coordinate formatter
Modifying the coordinate formatterInterpolations for imshow
Interpolations for imshowContour plot of irregularly spaced data
Contour plot of irregularly spaced dataLayer images with alpha blending
Layer images with alpha blendingVisualize matrices with matshow
Visualize matrices with matshowMultiple images with one colorbar
Multiple images with one colorbarpcolor images
pcolor imagespcolormesh grids and shading
pcolormesh grids and shadingpcolormesh
pcolormeshStreamplot
StreamplotQuadMesh Demo
QuadMesh DemoAdvanced quiver and quiverkey functions
Advanced quiver and quiverkey functionsQuiver Simple Demo
Quiver Simple DemoShading example
Shading exampleSpectrogram
SpectrogramSpy Demos
Spy DemosTricontour Demo
Tricontour DemoTricontour Smooth Delaunay
Tricontour Smooth DelaunayTricontour Smooth User
Tricontour Smooth UserTrigradient Demo
Trigradient DemoTriinterp Demo
Triinterp DemoTripcolor Demo
Tripcolor DemoTriplot Demo
Triplot DemoWatermark image
Watermark imageSubplots, axes and figures#
Align labels and titles
Align labels and titlesProgrammatically control subplot adjustment
Programmatically control subplot adjustmentAxes box aspect
Axes box aspectAxes Demo
Axes DemoControlling view limits using margins and sticky_edges
Controlling view limits using margins and sticky_edgesAxes properties
Axes propertiesAxes zoom effect
Axes zoom effectDraw regions that span an Axes
Draw regions that span an AxesEqual axis aspect ratio
Equal axis aspect ratioAxis label position
Axis label positionBroken axis
Broken axisCustom Figure subclasses
Custom Figure subclassesResize Axes with constrained layout
Resize Axes with constrained layoutResize Axes with tight layout
Resize Axes with tight layoutDifferent scales on the same Axes
Different scales on the same AxesFigure size in different units
Figure size in different unitsFigure labels: suptitle, supxlabel, supylabel
Figure labels: suptitle, supxlabel, supylabelAdjacent subplots
Adjacent subplotsGeographic Projections
Geographic ProjectionsCombine two subplots using subplots and GridSpec
Combine two subplots using subplots and GridSpecGridSpec with variable sizes and spacing
GridSpec with variable sizes and spacingGridspec for multi-column/row subplot layouts
Gridspec for multi-column/row subplot layoutsNested Gridspecs
Nested GridspecsInverted axis
Inverted axisManage multiple figures in pyplot
Manage multiple figures in pyplotSecondary Axis
Secondary AxisShare axis limits and views
Share axis limits and viewsShared axis
Shared axisFigure subfigures
Figure subfiguresMultiple subplots
Multiple subplotssubplot2grid
subplot2gridSubplots spacings and margins
Subplots spacings and marginsCreate multiple subplots using plt.subplots
Create multiple subplots using plt.subplotsPlots with different scales
Plots with different scalesZoom region inset Axes
Zoom region inset AxesStatistics#
Artist customization in box plots
Artist customization in box plotsBox plots with custom fill colors
Box plots with custom fill colorsBoxplots
BoxplotsBox plot vs. violin plot comparison
Box plot vs. violin plot comparisonSeparate calculation and plotting of boxplots
Separate calculation and plotting of boxplotsPlot a confidence ellipse of a two-dimensional dataset
Plot a confidence ellipse of a two-dimensional datasetViolin plot customization
Violin plot customizationErrorbar function
Errorbar functionDifferent ways of specifying error bars
Different ways of specifying error barsIncluding upper and lower limits in error bars
Including upper and lower limits in error barsCreate boxes from error bars using PatchCollection
Create boxes from error bars using PatchCollectionHexagonal binned plot
Hexagonal binned plotHistograms
HistogramsBihistogram
BihistogramCumulative distributions
Cumulative distributionsDemo of the histogram function's different histtype settings
Demo of the histogram function's different histtype settingsThe histogram (hist) function with multiple data sets
The histogram (hist) function with multiple data setsHistogram bins, density, and weight
Histogram bins, density, and weightMultiple histograms side by side
Multiple histograms side by sideTime Series Histogram
Time Series HistogramViolin plot basics
Violin plot basicsPie and polar charts#
Pie charts
Pie chartsBar of pie
Bar of pieNested pie charts
Nested pie chartsA pie and a donut with labels
A pie and a donut with labelsBar chart on polar axis
Bar chart on polar axisPolar plot
Polar plotError bar rendering on polar axis
Error bar rendering on polar axisPolar legend
Polar legendScatter plot on polar axis
Scatter plot on polar axisText, labels and annotations#
Accented text
Accented textAlign y-labels
Align y-labelsScale invariant angle label
Scale invariant angle labelAngle annotations on bracket arrows
Angle annotations on bracket arrowsAnnotate transform
Annotate transformAnnotating a plot
Annotating a plotAnnotate plots
Annotate plotsAnnotate polar plots
Annotate polar plotsArrow Demo
Arrow DemoAuto-wrap text
Auto-wrap textCompose custom legends
Compose custom legendsDate tick labels
Date tick labelsAnnotationBbox demo
AnnotationBbox demoUsing a text as a Path
Using a text as a PathText rotation mode
Text rotation modeThe difference between \dfrac and \frac
The difference between \dfrac and \fracFormat ticks using engineering notation
Format ticks using engineering notationAnnotation arrow style reference
Annotation arrow style referenceStyling text boxes
Styling text boxesFigure legend demo
Figure legend demoConfigure the font family
Configure the font familyUsing ttf font files
Using ttf font filesFont table
Font tableFonts demo (object-oriented style)
Fonts demo (object-oriented style)Fonts demo (keyword arguments)
Fonts demo (keyword arguments)Labelling subplots
Labelling subplotsLegend using pre-defined labels
Legend using pre-defined labelsLegend Demo
Legend DemoArtist within an artist
Artist within an artistConvert texts to images
Convert texts to imagesMathtext
MathtextMathematical expressions
Mathematical expressionsMath fontfamily
Math fontfamilyMultiline
MultilinePlacing text boxes
Placing text boxesConcatenate text objects with different properties
Concatenate text objects with different propertiesSTIX Fonts
STIX FontsRender math equations using TeX
Render math equations using TeXText alignment
Text alignmentText properties
Text propertiesControlling style of text and labels using a dictionary
Controlling style of text and labels using a dictionaryText rotation angle in data coordinates
Text rotation angle in data coordinatesTitle positioning
Title positioningUnicode minus
Unicode minusUsetex text baseline
Usetex text baselineUsetex font effects
Usetex font effectsText watermark
Text watermarkColor#
For a description of the colormaps available in Matplotlib, see the colormaps tutorial.
Color Demo
Color DemoColor by y-value
Color by y-valueColors in the default property cycle
Colors in the default property cycleNamed color sequences
Named color sequencesColorbar
ColorbarColormap reference
Colormap referenceCreate a colormap from a list of colors
Create a colormap from a list of colorsSelecting individual colors from a colormap
Selecting individual colors from a colormapList of named colors
List of named colorsWays to set a color's alpha value
Ways to set a color's alpha valueShapes and collections#
Arrow guide
Arrow guideReference for Matplotlib artists
Reference for Matplotlib artistsLine, Poly and RegularPoly Collection with autoscaling
Line, Poly and RegularPoly Collection with autoscalingCompound path
Compound pathDolphins
DolphinsMmh Donuts!!!
Mmh Donuts!!!Ellipse with orientation arrow demo
Ellipse with orientation arrow demoEllipse Collection
Ellipse CollectionEllipse Demo
Ellipse DemoDrawing fancy boxes
Drawing fancy boxesHatch demo
Hatch demoHatch style reference
Hatch style referencePlot multiple lines using a LineCollection
Plot multiple lines using a LineCollectionCircles, Wedges and Polygons
Circles, Wedges and PolygonsPathPatch object
PathPatch objectBezier curve
Bezier curveScatter plot
Scatter plotStyle sheets#
Bayesian Methods for Hackers style sheet
Bayesian Methods for Hackers style sheetDark background style sheet
Dark background style sheetFiveThirtyEight style sheet
FiveThirtyEight style sheetggplot style sheet
ggplot style sheetGrayscale style sheet
Grayscale style sheetPetroff10 style sheet
Petroff10 style sheetSolarized Light stylesheet
Solarized Light stylesheetStyle sheets reference
Style sheets referenceModule - pyplot#
Simple plot
Simple plotText and mathtext using pyplot
Text and mathtext using pyplotMultiple lines using pyplot
Multiple lines using pyplotTwo subplots using pyplot
Two subplots using pyplotModule - axes_grid1#
Anchored Direction Arrow
Anchored Direction ArrowAxes divider
Axes dividerDemo Axes Grid
Demo Axes GridAxes Grid2
Axes Grid2HBoxDivider and VBoxDivider demo
HBoxDivider and VBoxDivider demoShow RGB channels using RGBAxes
Show RGB channels using RGBAxesColorbar with AxesDivider
Colorbar with AxesDividerControl the position and size of a colorbar with Inset Axes
Control the position and size of a colorbar with Inset AxesPer-row or per-column colorbars
Per-row or per-column colorbarsAxes with a fixed physical size
Axes with a fixed physical sizeImageGrid cells with a fixed aspect ratio
ImageGrid cells with a fixed aspect ratioInset locator demo
Inset locator demoInset locator demo 2
Inset locator demo 2Make room for ylabel using axes_grid
Make room for ylabel using axes_gridParasite Simple
Parasite SimpleParasite Simple2
Parasite Simple2Align histogram to scatter plot using locatable Axes
Align histogram to scatter plot using locatable AxesSimple Anchored Artists
Simple Anchored ArtistsSimple Axes Divider 1
Simple Axes Divider 1Simple axes divider 3
Simple axes divider 3Simple ImageGrid
Simple ImageGridSimple ImageGrid 2
Simple ImageGrid 2Simple Axisline4
Simple Axisline4Module - axisartist#
Axis Direction
Axis Directionaxis_direction demo
axis_direction demoAxis line styles
Axis line stylesCurvilinear grid demo
Curvilinear grid demoDemo CurveLinear Grid2
Demo CurveLinear Grid2floating_axes features
floating_axes featuresfloating_axis demo
floating_axis demoParasite Axes demo
Parasite Axes demoParasite axis demo
Parasite axis demoTicklabel alignment
Ticklabel alignmentTicklabel direction
Ticklabel directionSimple axis direction
Simple axis directionSimple axis tick label and tick directions
Simple axis tick label and tick directionsSimple axis pad
Simple axis padCustom spines with axisartist
Custom spines with axisartistSimple Axisline
Simple AxislineSimple Axisline3
Simple Axisline3Showcase#
Anatomy of a figure
Anatomy of a figureFirefox
FirefoxIntegral as the area under a curve
Integral as the area under a curveShaded & power normalized rendering
Shaded & power normalized renderingPan/zoom events of overlapping axes
Pan/zoom events of overlapping axesStock prices over 32 years
Stock prices over 32 yearsXKCD
XKCDAnimation#
Decay
DecayAnimated histogram
Animated histogrampyplot animation
pyplot animationThe Bayes update
The Bayes updateThe double pendulum problem
The double pendulum problemAnimated image using a precomputed list of images
Animated image using a precomputed list of imagesFrame grabbing
Frame grabbingMultiple Axes animation
Multiple Axes animationPause and resume an animation
Pause and resume an animationRain simulation
Rain simulationAnimated 3D random walk
Animated 3D random walkAnimated line plot
Animated line plotAnimated scatter saved as GIF
Animated scatter saved as GIFOscilloscope
OscilloscopeMatplotlib unchained
Matplotlib unchainedEvent 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 eventMouse move and click events
Mouse move and click eventsCross-hair cursor
Cross-hair cursorData browser
Data browserFigure/Axes enter and leave events
Figure/Axes enter and leave eventsInteractive functions
Interactive functionsScroll event
Scroll eventKeypress event
Keypress eventLasso Demo
Lasso DemoLegend picking
Legend pickingLooking glass
Looking glassPath editor
Path editorPick event demo
Pick event demoPick event demo 2
Pick event demo 2Polygon editor
Polygon editorPong
PongResampling Data
Resampling DataTimers
TimersTrifinder Event Demo
Trifinder Event DemoViewlims
ViewlimsZoom modifies other Axes
Zoom modifies other AxesMiscellaneous#
Anchored Artists
Anchored ArtistsIdentify whether artists intersect
Identify whether artists intersectManual Contour
Manual ContourCoords Report
Coords ReportCustom projection
Custom projectionCustomize Rc
Customize RcAGG filter
AGG filterRibbon box
Ribbon boxAdd lines directly to a figure
Add lines directly to a figureFill spiral
Fill spiralFindobj Demo
Findobj DemoFont indexing
Font indexingFont properties
Font propertiesBuilding histograms using Rectangles and PolyCollections
Building histograms using Rectangles and PolyCollectionsHyperlinks
HyperlinksImage thumbnail
Image thumbnailPlotting with keywords
Plotting with keywordsMatplotlib logo
Matplotlib logoMultipage PDF
Multipage PDFMultiprocessing
MultiprocessingPacked-bubble chart
Packed-bubble chartPatheffect Demo
Patheffect DemoPrint image to stdout
Print image to stdoutRasterization for vector graphics
Rasterization for vector graphicsSet and get properties
Set and get propertiesApply SVG filter to a line
Apply SVG filter to a lineSVG filter pie
SVG filter pieTable Demo
Table DemoTickedStroke patheffect
TickedStroke patheffecttransforms.offset_copy
transforms.offset_copyZorder Demo
Zorder Demo3D plotting#
Plot 2D data on 3D plot
Plot 2D data on 3D plotDemo of 3D bar charts
Demo of 3D bar chartsClip the data to the axes view limits
Clip the data to the axes view limitsCreate 2D bar graphs in different planes
Create 2D bar graphs in different planes3D box surface plot
3D box surface plotPlot contour (level) curves in 3D
Plot contour (level) curves in 3DPlot contour (level) curves in 3D using the extend3d option
Plot contour (level) curves in 3D using the extend3d optionProject contour profiles onto a graph
Project contour profiles onto a graphFilled contours
Filled contoursProject filled contour onto a graph
Project filled contour onto a graphCustom hillshading in a 3D surface plot
Custom hillshading in a 3D surface plot3D errorbars
3D errorbarsFill between 3D lines
Fill between 3D linesFill under 3D line graphs
Fill under 3D line graphsCreate 3D histogram of 2D data
Create 3D histogram of 2D data2D images in 3D
2D images in 3DIntersecting planes
Intersecting planesParametric curve
Parametric curveLorenz attractor
Lorenz attractor2D and 3D Axes in same figure
2D and 3D Axes in same figureAutomatic text offsetting
Automatic text offsettingDraw flat objects in 3D plot
Draw flat objects in 3D plotGenerate 3D polygons
Generate 3D polygons3D plot projection types
3D plot projection types3D quiver plot
3D quiver plotRotating a 3D plot
Rotating a 3D plot3D scatterplot
3D scatterplot3D stem
3D stem3D plots as subplots
3D plots as subplots3D surface (colormap)
3D surface (colormap)3D surface (solid color)
3D surface (solid color)3D surface (checkerboard)
3D surface (checkerboard)3D surface with polar coordinates
3D surface with polar coordinatesText annotations in 3D
Text annotations in 3DTriangular 3D contour plot
Triangular 3D contour plotTriangular 3D filled contour plot
Triangular 3D filled contour plotTriangular 3D surfaces
Triangular 3D surfacesMore triangular 3D surfaces
More triangular 3D surfacesPrimary 3D view planes
Primary 3D view planes3D voxel / volumetric plot
3D voxel / volumetric plot3D voxel plot of the NumPy logo
3D voxel plot of the NumPy logo3D voxel / volumetric plot with RGB colors
3D voxel / volumetric plot with RGB colors3D voxel / volumetric plot with cylindrical coordinates
3D voxel / volumetric plot with cylindrical coordinates3D wireframe plot
3D wireframe plotAnimate a 3D wireframe plot
Animate a 3D wireframe plot3D wireframe plots in one direction
3D wireframe plots in one directionScales#
These examples cover how different scales are handled in Matplotlib.
Scales overview
Scales overviewAsinh scale
Asinh scaleLoglog aspect
Loglog aspectCustom scale
Custom scaleLog scale
Log scaleLogit scale
Logit scaleExploring normalizations
Exploring normalizationsSymlog scale
Symlog scaleSpecialty plots#
Hillshading
HillshadingAnscombe's quartet
Anscombe's quartetHinton diagrams
Hinton diagramsIshikawa Diagram
Ishikawa DiagramLeft ventricle bullseye
Left ventricle bullseyeMRI with EEG
MRI with EEGRadar chart (aka spider or star chart)
Radar chart (aka spider or star chart)The Sankey class
The Sankey classLong chain of connections using Sankey
Long chain of connections using SankeyRankine power cycle
Rankine power cycleSkewT-logP diagram: using transforms and custom projections
SkewT-logP diagram: using transforms and custom projectionsTopographic hillshading
Topographic hillshadingSpines#
Spines
SpinesSpine placement
Spine placementDropped spines
Dropped spinesMultiple y-axis with Spines
Multiple y-axis with SpinesCentered spines with arrows
Centered spines with arrowsTicks#
Align tick labels
Align tick labelsAutomatically setting tick positions
Automatically setting tick positionsCenter labels between ticks
Center labels between ticksColorbar Tick Labelling
Colorbar Tick LabellingCustom Ticker
Custom TickerFormat date ticks using ConciseDateFormatter
Format date ticks using ConciseDateFormatterDate Demo Convert
Date Demo ConvertPlacing date ticks using recurrence rules
Placing date ticks using recurrence rulesDate tick locators and formatters
Date tick locators and formattersCustom tick formatter for time series
Custom tick formatter for time seriesDate precision and epochs
Date precision and epochsDollar ticks
Dollar ticksSI prefixed offsets and natural order of magnitudes
SI prefixed offsets and natural order of magnitudesFig Axes Customize Simple
Fig Axes Customize SimpleMajor and minor ticks
Major and minor ticksMultilevel (nested) ticks
Multilevel (nested) ticksThe default tick formatter
The default tick formatterTick formatters
Tick formattersTick locators
Tick locatorsSet default y-axis tick labels on the right
Set default y-axis tick labels on the rightSetting tick labels from a list of values
Setting tick labels from a list of valuesMove x-axis tick labels to the top
Move x-axis tick labels to the topRotated tick labels
Rotated tick labelsFixing too many ticks
Fixing too many ticksUnits#
These examples cover the many representations of units in Matplotlib.
Annotation with units
Annotation with unitsArtist tests
Artist testsBar demo with units
Bar demo with unitsGroup barchart with units
Group barchart with unitsBasic units
Basic unitsEllipse with units
Ellipse with unitsEvans test
Evans testRadian ticks
Radian ticksInches and centimeters
Inches and centimetersUnit handling
Unit handlingEmbedding 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 demoEmbed in GTK3 with a navigation toolbar
Embed in GTK3 with a navigation toolbarEmbed in GTK3
Embed in GTK3Embed in GTK4 with a navigation toolbar
Embed in GTK4 with a navigation toolbarEmbed in GTK4
Embed in GTK4Embed in Qt
Embed in QtEmbed in Tk
Embed in TkEmbed in wx #2
Embed in wx #2Embed in wx #3
Embed in wx #3Embed in wx #4
Embed in wx #4Embed in wx #5
Embed in wx #5Embedding WebAgg
Embedding WebAggFourier Demo WX
Fourier Demo WXGTK3 spreadsheet
GTK3 spreadsheetGTK4 spreadsheet
GTK4 spreadsheetDisplay mathtext in WX
Display mathtext in WXMatplotlib with Glade 3
Matplotlib with Glade 3mplcvd -- an example of figure hook
mplcvd -- an example of figure hookpyplot with GTK3
pyplot with GTK3pyplot with GTK4
pyplot with GTK4SVG Histogram
SVG HistogramSVG Tooltip
SVG TooltipTool Manager
Tool ManagerEmbed in a web application server (Flask)
Embed in a web application server (Flask)Add a cursor in WX
Add a cursor in WXWidgets#
Examples of how to write primitive, but GUI agnostic, widgets in matplotlib
Annotated cursor
Annotated cursorButtons
ButtonsCheck buttons
Check buttonsCursor
CursorLasso Selector
Lasso SelectorMenu
MenuMouse Cursor
Mouse CursorMulticursor
MulticursorSelect indices from a collection using polygon selector
Select indices from a collection using polygon selectorPolygon Selector
Polygon SelectorRadio Buttons
Radio ButtonsImage scaling using a RangeSlider
Image scaling using a RangeSliderRectangle and ellipse selectors
Rectangle and ellipse selectorsSlider
SliderSnap sliders to discrete values
Snap sliders to discrete valuesSpan Selector
Span SelectorTextbox
TextboxUserdemo#
Nested GridSpecs
Nested GridSpecsSimple Legend01
Simple Legend01Simple Legend02
Simple Legend02Download all examples in Python source code: gallery_python.zip
Download all examples in Jupyter notebooks: gallery_jupyter.zip
Gallery generated by Sphinx-Gallery
On this page- Lines, bars and markers
- Images, contours and fields
- Subplots, axes and figures
- Statistics
- Pie and polar charts
- Text, labels and annotations
- Color
- Shapes and collections
- Style sheets
- Module - pyplot
- Module - axes_grid1
- Module - axisartist
- Showcase
- Animation
- Event handling
- Miscellaneous
- 3D plotting
- Scales
- Specialty plots
- Spines
- Ticks
- Units
- Embedding Matplotlib in graphical user interfaces
- Widgets
- Userdemo
Từ khóa » Thư Viện Matplotlib
-
Giới Thiệu Về Matplotlib (một Thư Viện Rất Hữu ích Của Python Dùng ...
-
Vẽ đồ Thị Trong Python Với Thư Viện Matplotlib | TopDev
-
Bài 1: Giới Thiệu Matplotlib - Matplotib Cơ Bản - VnCoder
-
Vẽ Biểu Đồ Với Thư Viện Matplotlib (Phần 1) - CodeLearn
-
Cách Cài Thư Viện Thường Dùng Trong Python Trên Windows
-
Khái Quát Về Trực Quan Hóa Dữ Liệu Với Thư Viện Matplotlib - TEK4
-
Bài 1. Matplotlib Cơ Bản
-
Hướng Dẫn Sử Dung Matplotlib Trong Python - W3seo
-
Python MatPlotlib
-
[PDF] Bài 8: Thư Viện Matplotlib
-
TOP THƯ VIỆN PYTHON TỐT NHẤT - Hybrid Technologies
-
Top 15 Thư Viện Python Tốt Nhất Cho Data Science | DEVMASTER
-
Python: Lập Bản đồ Python Với Matplotlib | V1Study