A: example of histogram:
Import numpy AS NP Import matplotlib.pyplot AS plt # polyline charts # AX = [23,26,28,31,32,33] # just creates a data # AY = [3.0,3.5,4.0,3.0,3.5, 4.0] # plt.plot (AX, AY, color = 'R & lt', as linewidth =. 1, u'1 label = ') # color line color specified, the contents of the label lABEL # plt.legend (LOC = 2) label placement # , with the tag numbers represent positions # plt.xlabel (u'X / deg.] C ') # plt.ylabel (u'Y /') # plt.title (u'2019 / 06/07 ') # # set each axis the range (x-axis value, y-axis values) # plt.axis ([0,36,0,8]) # plt.show () # bar graph # num_list = [for 1.5, 0.6, 7.8, 6] # plt.bar(range(len(num_list)), num_list,fc='r') # plt.show() # 堆叠柱状图 # name_list = ['Monday','Tuesday','Friday','Sunday'] # num_list = [1.5,0.6,7.8,6] # num_list1 = [1,2,3,1] # plt.bar(range(len(num_list)), num_list, label='boy',fc='y') # plt.bar(range(len(num_list)), num_list1, bottom=num_list, label='girl',tick_label = name_list,fc ='r') # plt.legend() # plt.show() # 并列柱状图 # name_list = ['Monday','Tuesday','Friday','Sunday'] # num_list = [1.5, 0.6, 7.8,6] #num_list1 = [1, 2, 3, 1] # x = list(range(len(num_list))) # total_width, n = 0.8, 2 # width = total_width / n # # plt.bar(x, num_list, width=width, label='boy', fc ='y') # for i in range(len(x)): # x[i] = x[i] + width # plt.bar(x, num_list1, width=width, label='girl', tick_label=name_list, fc='r') # plt.legend() # plt.show() # 条形柱状图 name_list = ['Monday','Tuesday','Friday','Sunday'] num_list = [1.5,0.6,7.8,6 ] plt.barh (Range (len (num_list)), num_list, tick_label = NAME_LIST) plt.show () '' ' set a background color: 1. FC: setting a uniform color (Example : fc = 'r' uniform red) 2. color: color not provided (Example: color = 'rgb', three colors recycling) 3. settings tab: NAME_LIST = [ 'catalog on Monday', 'on Tuesday', 'catalog on Friday' , 'the Sunday'] plt.bar (Range (len (num_list)), num_list, FC = 'R & lt', tick_label = NAME_LIST) '' '