1 import numpy as np 2 import matplotlib.pyplot as plt 3 4 ''' 5 餅狀圖顯示一個數據系列中各項總和的比例; 6 餅狀圖中的數據點顯示爲整個餅狀圖的百分比; 7 如:前十大品牌佔市場份額圖 8 9 ''' 10 # 例 11 labels = 'A','B','C','D' 12 fracs = [15.0,30.0,45.0,10.0] 13 14 explode = [0,0.05,0,0.08] 15 plt.axes(aspect=1) 16 plt.pie(x=fracs,labels=labels,autopct="%.0f%%",explode=explode,shadow=True) 17 plt.show() 18 19 # 練習 20 labels = 'SH','BJ','SZ','GZ' 21 fracs = [20,30,25,15] 22 explode = [0,0,0.08,0] 23 plt.pie(x= fracs,labels=labels,autopct='%.00f%%',explode=explode,shadow=True) 24 plt.show()
在將來面前,咱們永遠都是孩子。不斷思考,不斷學習,才能讓咱們走的更遠。學習
我的主頁:https://www.oceaneyes.cn/spa
我的學習博客:http://oceaneyes.top/.net
CSDN:https://blog.csdn.net/qq_16123129 code
長按二維碼關注,一塊兒交流學習~~~blog