Python數據可視化視頻課程網址:
https://edu.csdn.net/course/detail/29085
#用餅形圖來統計學生成績等級佔比
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
label=['A','B','C','D']
percent=[25,54,16,5]
#explode=[0,0.2,0,0]
explode=[0,0,0,0.1]
plt.axes(aspect=1)
plt.pie(x=percent,labels=label,autopct='%.2f%%',explode=explode,shadow=True)
plt.show()
#axes規定圓的形狀,默認是橢圓,規定爲1時就是標準的圓
#explode是規定每塊餅突出的程度
#shadow就是開啓陰影了