python - 在 matplotlib 中传递用于绘图的元组会在第 1 行引发“元组对象不可调用”错误。3
问题描述
我正在使用 matplotlib 绘制图表,但 python 抛出错误“元组不可调用”
import matplotlib.pyplot as plt
fig, ax = plt.subplots(2, 2)
ax[0, 0].plot(range(10), 'r')
ax[1, 0].plot(range(10), 'b')
ax[0, 1].plot(range(10), 'g')
ax[1, 1].plot(range(10), 'k')
plt.show()
解决方案
请检查您的 python 版本,因为 range() 函数在 python 2 和 python 3 中的工作方式不同
推荐阅读
- c# - 列表排序未产生预期结果
- python - 从python变量中获取年月日
- rust - 如何使用 turbofish 运算符进行通用特征实现
- ios - 快速编辑 MSMessage URL 数据
- python - 如何将函数添加为python的默认函数
- ios - 在手机中调试时 NSDate 返回 NULL
- visual-c++ - 如何设置具有多个不等式约束的 nlopt?
- php - Wordpress 帖子显示在不同页面中,按 H1 部分分隔
- laravel - 2 个视图到 1 个控制器 update()
- uwp - 发送更新时捕获的异常:System.NullReferenceException:对象引用未设置为对象的实例