Py学习  »  Python

如何用python绘制条形图?

Alpenliee • 3 年前 • 1232 次点击  

我想可视化一个带有两个类的条形图。Class=0表示蓝色,Class=1表示红色。

#here its my code
x = ['0','1']
real = df[df['fake'] == 0].count()
fake = df[df['fake'] == 1].count()
plt.bar(x, real, color='blue')
plt.bar(x, fake, color='red')
plt.title("Class Fake & Real")
plt.show() 

错误代码: ValueError:形状不匹配:无法将对象广播到单个形状

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/132712
 
1232 次点击  
文章 [ 2 ]  |  最新文章 3 年前