使用 matplotlib 在对数图中设置轴限制

2024-04-14

如何在使用 matplotlib 绘制的点周围创建空间?

For example, in this plot, the bottom left point is cutoff by the axis, but I would like a little more space between the point and the axis. example plot

import matplotlib.pyplot as plt
x = [2**i for i in xrange(4,14)]
y = [i**2 for i in x]
plt.loglog(x,y,'ro',basex=2,basey=2)
plt.xlim([0, 2**14]) # <--- this line does nothing
plt.show()

在交互模式下,xlim行返回(16.0, 16384),旧值而不是我尝试设置的新值。


无法在双对数图上绘制零 (log(0) = -inf)。它默默地失败了,因为它不能使用 0 作为限制。

Try plt.xlim([1,2**14])反而。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 matplotlib 在对数图中设置轴限制 的相关文章

随机推荐