我知道这个问题以前就被问过了(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也会出错。提前感谢您的帮助。