from matplotlib import pyplot as plt x = ['0', '1'] real, fake = 5, 10 plt.bar(x[0], real, color='blue') plt.bar(x[1], fake, color='red') plt.title("Class Fake & Real") plt.show()
你的错误可能来自错误的类型 real 和 fake .顺便说一句,对于为条形图配置不同的颜色,有一个更好的方法 solution .
real
fake