matplotlib.pyplot常用方法

本文详细介绍了使用matplotlib.pyplot进行轴属性设置的方法,包括如何获取和设置轴限制、关闭轴线和标签、使坐标轴等比例显示等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

matplotlib.pyplot提供了类似MATLAB的绘图框架。

(1)matplotlib.pyplot.axis(*v, **kwargs)--便捷的获取或设置轴属性的方法

>>> axis()

returns the current axes limits [xmin, xmax, ymin, ymax].:

>>> axis(v)

sets the min and max of the x and y axes, with v = [xmin, xmax, ymin, ymax].:

>>> axis('off')

turns off the axis lines and labels.:

>>> axis('equal')

changes limits of x or y axis so that equal increments of x and y have the same length; a circle is circular.:

>>> axis('scaled')

achieves the same result by changing the dimensions of the plot box instead of the axis data limits.:

>>> axis('tight')

changes x and y axis limits such that all data is shown. If all data is already shown, it will move it to the center of the figure without modifying (xmax - xmin) or (ymax - ymin). Note this is slightly different than in MATLAB.:

>>> axis('image')

is ‘scaled’ with the axis limits equal to the data limits.:

>>> axis('auto')

and:

>>> axis('normal')

are deprecated. They restore default behavior; axis limits are automatically scaled to make the data fit comfortably within the plot box.

if len(*v)==0, you can pass in xminxmaxyminymax as kwargs selectively to alter just those limits without changing the others.

>>> axis('square')

changes the limit ranges (xmax-xmin) and (ymax-ymin) of the x and y axes to be the same, and have the same scaling, resulting in a square plot.

The xmin, xmax, ymin, ymax tuple is returned


算了,文档内容太多了就不列举了,大家有想学习的可以去自行浏览

链接:https://matplotlib.org/api/pyplot_api.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值