matplotlib.pyplot 所有方法目录
关于pyplot, 基本20%的函数就完成80%的应用了 , 本文翻译了官方文档的pyplot1方法表格。看看pyplot还能做哪些事,大概了解还有哪些功能,需要用的时候心里有数。加粗的是常用的方法。
方法 | 官方描述 | 功能 |
---|---|---|
acorr | Plot the autocorrelation of x. | 画出x的自相关性 |
angle_spectrum | Plot the angle spectrum. | 绘制角度谱。 |
annotate | Annotate the point xy with text text. | 给点xy加文本注释 |
arrow | Add an arrow to the axes. | 在横轴上加一条水平线 |
autoscale | Autoscale the axis view to the data (toggle). | 自动度量数据的axis视图(切换) |
axes | Add an axes to the current figure and make it the current axes. | 向当前图形添加一个轴,并使其成为当前轴。 |
axhline | Add a horizontal line across the axis. | 在横轴上加一条水平线。 |
axhspan | Add a horizontal span (rectangle) across the axis. | 添加横轴的水平跨度(矩形) |
axis | Convenience method to get or set some axis properties. | 方便的方法获取或设置一些轴属性。 |
axvline | Add a vertical line across the axes. | 在坐标轴上加一条垂直线 |
axvspan | Add a vertical span (rectangle) across the axes. | 在坐标轴上增加一个垂直的跨度(矩形)。 |
bar | Make a bar plot. | 做个柱状图。 |
barbs | Plot a 2D field of barbs. | 绘制一个2D向量场。 |
barh | Make a horizontal bar plot. | 做一个水平柱状图。 |
box | Turn the axes box on or off on the current axes. | 打开或关闭当前轴上的轴框 |
boxplot | Make a box and whisker plot. | 箱线图 |
broken_barh | Plot a horizontal sequence of rectangles. | 绘制矩形的水平序列。 |
cla | Clear the current axes. | 清除当前轴。 |
clabel | Label a contour plot. | 标记等高线图。 |
clf | Clear the current figure. | 清除当前图形。 |
clim | Set the color limits of the current image. | 设置当前图像的颜色限制。 |
close | Close a figure window. | 关闭图形窗口。 |
cohere | Plot the coherence between x and y. | 绘制x和y之间的相干性。 |
colorbar | Add a colorbar to a plot. | 在绘图中添加一个彩色条。 |
contour | Plot contours. | 画等高线图 |
contourf | Plot contours. | 画等高线图 |
csd | Plot the cross-spectral density. | 绘制交叉谱密度。 |
delaxes | Remove the Axes ax (defaulting to the current axes) from its figure. | 从其图形中删除ax轴(默认为当前轴) |
draw | Redraw the current figure. | 重画当前图形。 |
errorbar | Plot y versus x as lines and/or markers with attached errorbars. | 将y与x绘制成直线和/或带有附加错误条的标记。 |
eventplot | Plot identical parallel lines at the given positions. | 在给定位置绘制相同的平行线。 |
figimage | Add a non-resampled image to the figure. | 向图中添加一个未重新采样的图像 |
figlegend | Place a legend on the figure. | 在图形上放一个图例。 |
fignum_exists | Return whether the figure with the given id exists. | 返回具有给定id的图是否存在。 |
figtext | Add text to figure. | 添加文本到图 |
figure | Create a new figure. | 创建一个新图。 |
fill | Plot filled polygons. | 图填充多边形 |
fill_between | Fill the area between two horizontal curves | . 填充两条水平曲线之间的区域。 |
fill_betweenx | Fill the area between two vertical curves.v | 填充两条垂直曲线之间的区域 |
findobj | Find artist objects. | 找到Artist对象 |
gca | Get the current Axes instance on the current figure matching the given keyword args, or create one. | 获取与给定关键字args匹配的当前图形上的当前轴实例,或创建一个 |
gcf | Get the current figure. | 获取当前图片。 |
gci | Get the current colorable artist. | 获取当前的可着色Artist。 |
get_figlabels | Return a list of existing figure labels. | 返回现有图形标签的列表 |
get_fignums | Return a list of existing figure numbers. | 返回现有图号的列表。 |
grid | Configure the grid lines. | 配置网格线 |
hexbin | Make a 2D hexagonal binning plot of points x, y. | 做一个点x, y的二维六边形宾线图。 |
hist | Plot a histogram. | 绘制一个直方图 |
hist2d | Make a 2D histogram plot. | 做一个二维直方图图。 |
hlines | Plot horizontal lines at each y from xmin to xmax. | 绘制y轴xmin至xmax处的水平线 |
imread | Read an image from a file into an array. | 将图像从文件中读取到数组中 |
imsave | Save an array as an image file. | 将数组保存为图像文件 |
imshow | Display data as an image; i.e. | 以图像的形式显示数据 |
install_repl_displayhook | Install a repl display hook so that any stale figure are automatically redrawn when control is returned to the repl. | 安装一个repl显示钩子,这样当控制权返回到repl时,任何陈旧的图形都会自动重绘。 |
ioff | Turn the interactive mode off. | 关闭交互模式 |
ion | Turn the interactive mode on. | 打开交互模式 |
isinteractive | Return whether to redraw after every plotting command. | 返回是否重新绘制后,每个绘图命令 |
legend | Place a legend on the axes. | 在坐标轴上放一个图例。 |
locator_params | Control behavior of major tick locators. | 控制主要刻度定位器的行为。 |
loglog | Make a plot with log scaling on both the x and y axis. | 在x轴和y轴上做一个对数缩放的图 |
magnitude_spectrum | Plot the magnitude spectrum. | 绘制震级谱。 |
margins | Set or retrieve autoscaling margins. | 设置或检索自动缩放边距。 |
matshow | Display an array as a matrix in a new figure window. | 在一个新的图形窗口中以矩阵的形式显示数组。 |
minorticks_off | Remove minor ticks from the axes. | 从轴中删除小刻度。 |
minorticks_on | Display minor ticks on the axes. | 在轴上显示小刻度 |
pause | Pause for interval seconds. | 间隔秒暂停。 |
pcolor | Create a pseudocolor plot with a non-regular rectangular grid. | 创建一个非规则矩形网格的伪色图。 |
pcolormesh | Create a pseudocolor plot with a non-regular rectangular grid. | 创建一个非规则矩形网格的伪色图 |
phase_spectrum | Plot the phase spectrum. | 绘制相谱图。 |
pie | Plot a pie chart. | 画一个饼图。 |
plot | Plot y versus x as lines and/or markers. | 图y和x作为直线和/或标记。 |
plot_date | Plot data that contains dates. | 包含日期的绘图数据。 |
plotfile | [Deprecated] Plot the data in a file. | [已弃用]在文件中绘制数据。 |
polar | Make a polar plot. | 极坐标画一个极坐标图。 |
psd | Plot the power spectral density. | 绘制功率谱密度 |
quiver | Plot a 2D field of arrows. | 画一个2D的箭头场。 |
quiverkey | Add a key to a quiver plot. | 给箭头添加一个键。 |
rc | Set the current rc params. | 设置当前rc参数 |
rc_context | Return a context manager for managing rc settings. | 返回一个上下文管理器来管理rc设置 |
rcdefaults | Restore the rc params from Matplotlib’s internal default style. | 从Matplotlib的内部默认样式中恢复rc参数 |
rgrids | Get or set the radial gridlines on the current polar plot. | 获取或设置当前极线图上的径向网格线。 |
savefig | Save the current figure. | 保存当前图形。 |
sca | Set the current Axes instance to ax. | 将当前的Axes实例设置为ax |
scatter | A scatter plot of y vs. | y和的散点图 |
sci | Set the current image. | 设置当前图像。 |
semilogx | Make a plot with log scaling on the x axis. | 在x轴上做一个对数缩放图。 |
semilogy | Make a plot with log scaling on the y axis. | 在y轴上用对数尺度做一个图 |
set_cmap | Set the default colormap, and applies it to the current image if any. | 设置默认的颜色映射,并将其应用于当前图像(如果有的话)。 |
setp | Set a property on an artist object. | 在artist对象上设置一个属性。 |
show | Display all figures. | 显示所有图。 |
specgram | Plot a spectrogram. | 谱图 |
spy | Plot the sparsity pattern of a 2D array. | 绘制二维数组的稀疏模式 |
stackplot | Draw a stacked area plot. | 绘制堆叠区域图。 |
stem | Create a stem plot. | 创建一个茎区。 |
step | Make a step plot. | 做一个阶梯图。 |
streamplot | Draw streamlines of a vector flow. | 绘制矢量流的流线。 |
subplot | Add a subplot to the current figure. | 在当前图中添加一个子图。 |
subplot2grid | Create an axis at specific location inside a regular grid. | 在规则网格的特定位置创建一个轴 |
subplot_tool | Launch a subplot tool window for a figure. | 启动子图绘制工具窗口 |
subplots | Create a figure and a set of subplots. | 创建一个图和一组子图。 |
subplots_adjust | Tune the subplot layout. | 调整子地块布局 |
suptitle | Add a centered title to the figure. | 在图中添加一个居中标题 |
switch_backend | Close all open figures and set the Matplotlib backend. | 关闭所有打开的图形并设置Matplotlib后端。 |
table | Add a table to an Axes. | 向坐标轴添加一个表。 |
text | Add text to the axes. | 添加文本到轴 |
thetagrids | Get or set the theta gridlines on the current polar plot. | 获取或设置当前极坐标图上的theta网格线 |
tick_params | Change the appearance of ticks, tick labels, and gridlines. | 更改刻度、刻度标签和网格线的外观。 |
ticklabel_format | Change the ScalarFormatter used by default for linear axes. | 更改默认用于线性轴的ScalarFormatter |
tight_layout | Automatically adjust subplot parameters to give specified padding. | 自动调整子图参数以提供指定的填充。 |
title | Set a title for the axes. | 设置坐标轴的标题。 |
tricontour | Draw contours on an unstructured triangular grid. | 在一个非结构化的三角形网格上画轮廓线 |
tricontourf | Draw contours on an unstructured triangular grid. | 在一个非结构化的三角形网格上画轮廓线 |
tripcolor | Create a pseudocolor plot of an unstructured triangular grid. | 创建一个非结构化的三角形网格的伪色图 |
triplot | Draw a unstructured triangular grid as lines and/or markers. | 画一个非结构化的三角形网格作为线和/或标记 |
twinx | Make and return a second axes that shares the x-axis. | 生成并返回第二个共享x轴的轴 |
twiny | Make and return a second axes that shares the y-axis. | 制造并返回共享y轴的第二个轴 |
uninstall_repl_displayhook | Uninstall the matplotlib display hook. | 卸载matplotlib显示钩子 |
violinplot | Make a violin plot. | 制作小提琴图 |
vlines | Plot vertical lines. | 绘制垂直线。 |
xcorr | Plot the cross correlation between x and y. | 绘制x和y之间的互相关系。 |
xkcd | Turn on xkcd sketch-style drawing mode. | 打开xkcd素描式绘制模式 |
xlabel | Set the label for the x-axis. | 设置x轴的标签 |
xlim | Get or set the x limits of the current axes. | 获取或设置当前轴的x限制。 |
**xscale | ** Set the x-axis scale. | 设置x轴比例。 |
xticks | Get or set the current tick locations and labels of the x-axis. | 获取或设置x轴的当前刻度位置和标签。 |
ylabel | Set the label for the y-axis. | 设置y轴的标签 |
ylim | Get or set the y-limits of the current axes. | 获取或设置当前轴的y限。 |
yscale | Set the y-axis scale. | 设置y轴比例。 |
yticks | Get or set the current tick locations and labels of the y-axis. | 获取或设置y轴的当前刻度点位置和标签。 |
pyplot官方文档,https://matplotlib.org/api/pyplot_summary.html ↩︎