python-3.x - “元组”对象不是使用 matplotlib 库的可调用错误?

标签 python-3.x

1  def auto_correlate(x):
2     cor = np.correlate(x,x,mode="full")
3     return cor[N-1:]

4  c = np.zeros(N)
5  c = auto_correlate(x-ave)/N
6  plt.plot(c)
7  plt.xlim(-1000, 10000)
8  plt.xlabel(r'$i$',fontsize=16)
9  plt.ylabel(r'$\varphi(i)$',fontsize=16)
10 print('\sigma^2 = ', std**2)
11 plt.show()

为什么我不断收到错误 'tuple' object not callable online 7 ?请解释

最佳答案

看起来您可能已经覆盖了 plt.xlim 函数。

你有没有跑过plt.xlim=(-1000, 10000) ? (注意“=”)

类型 plt.xlim并运行它来检查。

输出应该是这样的:

<function matplotlib.pyplot.xlim(*args, **kwargs)>

关于python-3.x - “元组”对象不是使用 matplotlib 库的可调用错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47946517/

相关文章:

python - 无法安装zbar

python - pandas multiindex - 根据子索引的数量删除行

python - Scipy Curve_fit。多个参数的单独界限

python - 使用协程作为装饰器

python - 模式计算器 Python

python - 类型错误 : cannot convert the series to <class 'float' >

python - 识别 pandas 中由多列组成的组中的第一个非零元素

python-3.x - 使用 Selenium ,如何单击下拉菜单进入https://www.phptravels.net/的登录页面

python - 为什么 python 假设我的路径是项目根目录,这是两个目录级别?

python - 在 QPlainTextEdit() 中禁用回车(按 Enter 键)