English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Matplotlib Pyplot API

Below is a new untitled notebook with the .ipynb extension (representing an IPython notebook) displayed in a new tab in the browser.

matplotlib.pyplot is a collection of command-style functions that make Matplotlib work like MATLAB. Each Pyplot function will make some changes to the graph. For example, the function creates a graph, a plotting area within a graph, draws some lines within the plotting area, decorates the graph with labels, etc.

Draw (chart) type

NumberFunctionDescription
1BarDraw a bar chart (bar graph).
2BarhDraw a horizontal bar chart.
3BoxplotDraw a boxplot and whisker plot.
4HistDraw a histogram.
5hist2dDraw2D histogram.
6PieDraw a pie chart.
7PlotDraw the lines and/Or mark.
8PolarDraw a polar coordinate plot.
9ScatterDraw a scatter plot of x and y.
10StackplotDraw a stacked area plot.
11StemDraw a stem plot
12StepDraw a step plot.
13QuiverDraw a two-dimensional arrow field.

Image functions

NumberFunctionDescription
1ImreadRead images from files into arrays.
2ImsaveSave arrays like in image files.
3ImshowDisplay images on the axis.

Axis Functions

NumberFunctionDescription
1AxesAdd Axis to the Figure.
2TextAdd Text to the Axis.
3TitleSet the Title of the Current Axis.
4XlabelSet the X-axis Label of the Current Axis.
5XlimGet or Set the X Limit of the Current Axis.
6XscaleSet the X-axis Scaling.
7XticksGet or Set the X Limit of the Current Tick Position and Label.
8YlabelSet the Y-axis Label of the Current Axis.
9YlimGet or Set the Y Limit of the Current Axis.
10YscaleSet the Y-axis Scaling.
11YticksGet or Set the Y Limit of the Current Tick Position and Label.

Graphical Function

NumberFunctionDescription
1FigtextAdd Text to the Figure.
2FigureCreate a New Figure.
3ShowDisplay a Figure.
4SavefigSave Current Figure.
5CloseClose a Figure Window.