"" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "", "" "". "" "" "" "" "" "" "" "," "" "" "," "" "" "," "" "," "" ">> Pie chart .py>> Author: Liu Yang>> e-mail: [Email protected]>> blog: www.cnblogs.com/liu66blog "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "." "" "" "" "" "" "" "" "#!/usr/bin/env python#-*-Coding:" "" "" ". Utf-8-*-import Matplotlibimport Matplotlib.pyplot as plt# defines the font to use to prevent Chinese garbled font=matplotlib.font_manager. Fontproperties (fname=r "C:\Windows\Fonts\Deng.ttf") # Pie chart pie chart def pie_chart (): # Add tags for each zone labels=[' A ', ' B ', ' C ', ' D ' ] # data per chunk fracs=[15,30,45,10] #使x y-axis proportional plt.axes (aspect=1) # Highlight part of the area explode=[0,0.05,0,0] #autopc T show percent Plt.pie (x=fracs,labels=labels,autopct= '%.0f%% ', Explode=explode) plt.title (' Pie chart ', Fontproperties=font) # Display Plt.show () if __name__ = = ' __main__ ': Pie=pie_chart ()
[Python Study Notes] Pie chart drawing