栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Matplotlib:取消Matplotlib 2.0中引入的轴偏移

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Matplotlib:取消Matplotlib 2.0中引入的轴偏移

在matplotlib v2.0.x中,默认轴边距已从0更改为0.05,
它是控制轴上数据周围空白的值。
看[这里](http://matplotlib.org/devdocs/users/dflt_style_changes.htmlauto-
限制)了解更多关于这一变化背后的原因。
有几种方法可以恢复以前的行为。
1) 要将单个轴实例的“边距”重置为0:

plt.margins(0)

or

ax.margins(0)

2) To reset

margins
to 0 for all plots in a script, use
rcParams
and set
this at the top of your script:

plt.rcParams['axes.autolimit_mode'] = 'round_numbers'plt.rcParams['axes.xmargin'] = 0.plt.rcParams['axes.ymargin'] = 0.

3) 要更改计算机上所有绘图的默认值,请修改

matplotlibrc
file以包含以下行:

axes.autolimit_mode: round_numbersaxes.xmargin        : 0.axes.ymargin        : 0.

请注意,要使用方法(1)并真正获得旧行为,您可能还需要
设定

plt.rcParams公司['轴自动限制模式']='整数'



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/641083.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号