作者disney82231 (小刀会序曲)
看板Python
标题[问题] plot结果与资料有异
时间Thu May 2 15:38:29 2019
大家好,我的资料是(9820,2),其中一个变数是类别变数为0跟1
0的个数为689个,1为9131个,我想画出一个散布图分别为1跟0上色
groups = error_df.groupby('true_class')
groups.size()
6fig, ax = plt.subplots()
for name, group in groups:
ax.plot(group.index, group.reconstruction_error, marker='o', ms=3,
linestyle='',
label= "fraud" if name == 1 else "normal",
color="blue" if name == 1 else "k")
ax.legend()
plt.title("Reconstruction error for different classes")
plt.ylabel("Reconstruction error")
plt.xlabel("Data point index")
plt.show();
但跑不出来不知道为什麽蓝色的区域盖过黑色的区域,谢谢
https://imgur.com/a/evlxjXD
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 120.126.194.162
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1556782712.A.574.html