python - Python 中的“元组不可调用”

标签 python matplotlib

<分区>

我在尝试绘制类似这样的东西时在 Python 中遇到错误:

import matplotlib.pyplot as plt

plt.plot(list_x,list_y)

正如我在标题中提到的,这个错误是:

'tuple' object is not callable 

我想知道我的代码有什么问题,但后来我意识到即使我粘贴了正确的代码(例如:http://matplotlib.org/examples/pylab_examples/accented_text.html)也会出现此错误。

这很奇怪。感谢您提前提供任何帮助提示。

最佳答案

如评论中所述,您可能不小心覆盖了 plt.plot 的值

Python 2.7.5+ (default, Feb 27 2014, 19:37:08) 
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot
<function plot at 0x2285488>

如果问题在新解释器中仍然存在,您应该查看 plt.plot 显示的元组是什么。也许这是出了什么问题的线索。

关于python - Python 中的“元组不可调用”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22762481/

相关文章:

python - 了解 Matplotlib 的箭袋绘图

python - 具有多个 Y 值的散点图,每个类别 X 标签均带有线条

python - python folium(map.html文件)与dash应用程序集成后如何刷新?

Python:set.pop() 的用例是什么?

python - matplotlib 中的动画箭头

Python 如何设置 matplotlib 图的轴

python - 如何使用 "upper"和 "lower"值构建一致的离散颜色图/颜色条

python - 连接同一数据框中的行

javascript - 用于捕获完整文件路径/UNC 的 Web 对话框

python - grep 不允许我写 `[:alpha:]` 当我的意思是 `[:alph]` 但其他工具可以