【发布时间】:2018-10-03 04:54:53
【问题描述】:
【问题讨论】:
-
您只需将您的 ylimit 扩展为
plt.ylim(0, 14.5)或类似plt.ylim(0, 15)
标签: python matplotlib
【问题讨论】:
plt.ylim(0, 14.5) 或类似 plt.ylim(0, 15)
标签: python matplotlib
你能添加一些源代码吗?
当我这样做时:
import matplotlib.pyplot as plt
import numpy as np
arr = np.array([450, 448, 477, 500, 504, 519, 526, 565, 562, 565, 602, 608, 638, 643, 676, 686])
plt.plot(arr, color = 'blue')
plt.grid(1)
我没有这样的问题。
当我让你正确时,你的问题是轴上的 14。你可以在settings of the figure中调整这个
同样可以通过修改 subplots_adjust() 来实现
plt.subplots_adjust(top=0.9, bottom = 0.1, left = 0.1, right = 0.9)
通常这应该没有必要,但由于我不知道你的代码,所以我不知道你在哪里破坏了设置。
【讨论】:
图表是使用 matplotlib 1.5 或更低版本生成的。除了更新matplotlib,还可以设置y方向的margin大于0,
plt.margins(y=0.1)
或者直接设置你想要的限制
plt.ylim(0,15)
【讨论】: