z_pie.html


001| ####################################################################################################
002| from os import path
003| import matplotlib.pyplot as plt
004| ####################################################################################################
005| BasePath = r'C:\CJS\prj\Python\charts'
006| ImgsPath = path.join(BasePath,'img')
007| 
008| 
009| ##================================================================================================##
010| def do_chart_pie ():
011|     filename = path.join(ImgsPath,'z_pie.png')
012| 
013|     da = [5, 7, 17, 36]
014|     na = ['New York', 'Minneapolis', 'California', 'St.Paul']
015|     axa = plt.subplot(221)
016|     axa.set_title('Locations')
017|     axa.pie(da, labels=na, startangle=90, counterclock=False)
018| 
019|     db = [4, 7, 2, 5, 7, 7, 1, 1]
020|     nb = ['HESD', 'NSC', 'ITC', 'EIS/IT', 'HEMT', 'IT/CRMA', 'CDS', 'SAP']
021|     axb = plt.subplot(222)
022|     axb.set_title('3M Career')
023|     axb.pie(db, labels=nb, startangle=90, counterclock=False)
024| 
025|     dc = [5, 7, 6, 5, 33, 7]
026|     nc = ['Pre-K', 'K-6', '7-12', 'College', 'Working', 'Retired']
027|     axc = plt.subplot(223)
028|     axc.set_title('Occupations')
029|     axc.pie(dc, labels=nc, startangle=90, counterclock=False)
030| 
031|     fig = plt.gcf()
032|     fig.suptitle('My Years on Earth...', fontsize=13)
033| 
034|     fig.set_figwidth(6.4)
035|     fig.set_figheight(6.4)
036|     fig.subplots_adjust(left=0.10, bottom=0.10, right=0.90, top=0.90, hspace=0.50, wspace=0.50)
037|     fig.savefig(filename)
038| 
039| 
040| 
041| ####################################################################################################
042| if __name__ == '__main__':
043|     do_chart_pie()
044| ####################################################################################################
045| '''eof'''
046|