[問題] matplotlib 畫餅圖時值0能否去除?
各位大大好 小弟我自學python兩個月,
主要對資料處理及視覺化有興趣,目前想將資料以餅圖(pie)呈現
但因為資料中有0值,導致結果輸出時,0值並未消失,還顯示在圖上
有點多餘,想問一下各位大大有沒有甚麼辦法可以移除呢?
https://imgur.com/a/Kugrk
fig = plt.figure(figsize=(8,4),dpi=300,facecolor="w")
fig.suptitle("練習用",fontsize=15,fontweight="heavy")
fig.subplots_adjust(top=0.8,wspace=0.1,hspace=0.3)
def ae(a,x):
ad = fig.add_subplot(a,aspect="equal")
ad.set_title(x)
C =df_crosstab.loc[x].plot.pie(autopct='%0.0f%%',
pctdistance=0.6,textprops={"fontsize":6})
C.set_ylabel("")
ae(111,"健體")
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.25.127.5
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1516112179.A.52F.html
→
01/16 22:54,
7年前
, 1F
01/16 22:54, 1F