【发布时间】:2013-08-04 03:10:08
【问题描述】:
我意识到这个问题之前已经被问过(Python Pyplot Bar Plot bars disappear when using log scale),但给出的答案对我不起作用。我设置了我的 pyplot.bar(x_values, y_values, etc, log = True) 但收到一条错误消息:
"TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'"
我一直在寻找 pyplot 代码的实际示例,该示例使用 y 轴设置为记录的条形图,但没有找到。我做错了什么?
代码如下:
import matplotlib.pyplot as pyplot
ax = fig.add_subplot(111)
fig = pyplot.figure()
x_axis = [0, 1, 2, 3, 4, 5]
y_axis = [334, 350, 385, 40000.0, 167000.0, 1590000.0]
ax.bar(x_axis, y_axis, log = 1)
pyplot.show()
即使我删除了 pyplot.show,我也会收到错误消息。提前感谢您的帮助
【问题讨论】:
-
请显示使用完整回溯
标签: python matplotlib typeerror bar-chart