python 中使用matplotlib.pyplot 绘图,其中plt.axes()的用法

python 中使用matplotlib.pyplot 绘图,其中plt.axes()的用法

import matplotlib.pyplot as plt 后,可以在命令行中输入指令:

plt.axes?

来查看axes函数的用法,其返回的文档如下:

Signature: plt.axes(arg=None, **kwargs)
Docstring:
Add an axes to the current figure and make it the current axes.
Parameters

arg : None or 4-tuple or Axes
The exact behavior of this function depends on the type:
- None: A new full window axes is added using
subplot(111, **kwargs)
- 4-tuple of floats rect = [left, bottom, width, height].
A new axes is added with dimensions rect in normalized
(0, 1) units using ~.Figure.add_axes on the current figure.
- .Axes: This is equivalent to .pyplot.sca. It sets the current
axes to arg. Note: This implicitly changes the current figure to
the parent of arg.
… note:: The use of an Axes as an argument is deprecated and will be
removed in v3.0. Please use .pyplot.sca instead.

Other Parameters

**kwargs :
For allowed keyword arguments see .pyplot.subplot and
.Figure.add_axes respectively. Some common keyword arguments are
listed below:
========= ===========
kwarg Accepts Description
========= ===========
facecolor color the axes background color
frameon bool whether to display the frame
sharex otherax share x-axis with otherax
sharey otherax share y-axis with otherax
polar bool whether to use polar axes
aspect [str | num] [‘equal’, ‘auto’] or a number. If a number, the
ratio of y-unit/x-unit in screen-space. See also
~.Axes.set_aspect.
========= ===========
Returns

axes : Axes
The created or activated axes.
Examples

Creating a new full window axes::
>>> plt.axes()
Creating a new axes with specified dimensions and some kwargs::
>>> plt.axes((left, bottom, width, height), facecolor=‘w’)
File: d:\anaconda3\lib\site-packages\matplotlib\pyplot.py
Type: function

可见其主要参数就是一个由所需子图矩形框左下角点的坐标与所需子图矩形框的长宽高组成的元组。

你可能感兴趣的:(学习,python)