1 # salary levels of employees in a company between [3500,35000] and has a total of 55 individual 2 # for everyone to custom groups to view the salary levels of most of the staff to do the salary guide to the company. . 3 Import matplotlib.pyplot AS PLT . 4 Import numpy AS NP . 5 . 6 plt.figure () . 7 . 8 plt.rcParams [ ' font.sans serif- ' ] = ' SimHei ' . 9 plt.rcParams [ ' axes.unicode_minus ' ] = False 10 . 11 Data = np.random.randint (= 3500 Low, High = 35000, size = 33 is ) 12 is Group_Num 10 = 13 is= data.max PTP () - data.min () 14 STEP = int (np.ceil (PTP / Group_Num)) 15 bins = np.arange (data.min (), data.max () + STEP, STEP) 16 plt.hist (Data, bins = bins, Color = " # EEE685 " , edgecolor = " # 8B864E " ) . 17 18 is plt.xlabel ( " salary (RMB) " ) . 19 plt.ylabel ( " the number (a) " ) 20 is plt.title ( " payroll histogram " ) 21 is 22 is xticks np.arange = (3500, 35001, 3150 ) 23 is plt.xticks (bins, xticks) 24 yticks np.arange = (0, 10 ) 25 plt.yticks (yticks) 26 is plt.grid (True, Axis = " Y " , Alpha = 0.2 ) 27 plt.show () 28 29 30 # salary levels of employees in a company between [3500,35000] and has a total of 55 individuals 31 # so that we own custom groups to view the salary levels of most of the staff to do the salary guide to the company.
[] Data Analysis & Data Mining salary distribution histogram
Guess you like
Origin www.cnblogs.com/Tree0108/p/12115948.html
Ranking