http://matplotlib.org/api/ticker_api.html 说
什么是斧头?如果它是我从中理解的pyplot对象ax.get_xaxis()。get_major_formatter()。set_useOffset(假)
ax.plot(np.arange(2000,2010),范围(10))
比起为什么我说:
In [107]: ax.get_xaxis
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-107-7bca17863338> in <module>()
----> 1 ax.get_xaxis
AttributeError: 'module' object has no attribute 'get_xaxis'
答案 0 :(得分:0)
以下是应该写在那里的完整代码:
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1)
ax.plot(np.arange(2000, 2010), range(10))
ax.get_xaxis().get_major_formatter().set_useOffset(False)
plt.show()