[問題] plot結果與資料有異

看板Python作者 (小刀會序曲)時間6年前 (2019/05/02 15:38), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
大家好,我的資料是(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://www.ptt.cc/bbs/Python/M.1556782712.A.574.html
文章代碼(AID): #1SofvuLq (Python)
文章代碼(AID): #1SofvuLq (Python)