code: import matplotlib
  matplotlib.use('Agg')
  import matplotlib.patches as mpatches
  import random
  import math
  import numpy as np
  import matplotlib.pyplot as plt
  import itertools
  from matplotlib import rcParams
  from matplotlib.backends.backend_pdf import PdfPages
  
  N = 20
  width = 0.15 # the width of the bars
  ind = np.arange(N) # the x locations for the groups
  
  #fileName = 'diffrent_set_size'
  fileName = 'sims'
  folder = 'final_plot/'
  perfault = []
  
  # plot in pdf
  pp = PdfPages(folder + fileName + '.pdf')
  
  percentageU = 75
  title = 'Tasks: '+ repr(2) + ', $U^N_{SUM}$:'+repr(percentageU)+'%' + ', Fault Rate:'+repr(10**-4)
  
  plt.title(title, fontsize=20)
  plt.grid(True)
  plt.ylabel('Expected Miss Rate', fontsize=20)
  ax = plt.subplot()
  ax.set_yscale("log")
  #ax.set_xlim([0, 11])
  ax.set_ylim([10**-5,10**0])
  ax.set_xticks(ind + width /2)
  ax.set_xticklabels(('S1','S2','S3','S4','S5','S6','S7','S8','S9','S10','S11','S12','S13','S14','S15','S16','S17','S18','S19','S20'))
  ax.tick_params(axis='both', which='major',labelsize=18)
  
  SIM = [8.45e-05, 9.4e-05, 9.35e-05, 9.7e-05, 0.000105, 0.000186, 0.000101, 0.0001055, 9.4e-05, 0.000184, 0.000182, 0.0001035, 0.000206, 0.000111, 0.000205, 0.000106, 9.25e-05, 0.000213, 0.000101, 8.95e-05, 8.85e-05, 0.0, 0.000207, 9.65e-05, 9.05e-05, 0.000243]
  #[8.45e-05, 9.4e-05, 9.35e-05, 9.7e-05, 0.000105, 0.000186, 0.000101, 0.0001055, 9.4e-05, 9.7e-05, 0.000184, 0.000182, 0.0001035, 0.000206, 0.000111, 0.000205, 0.0001025, 0.000106, 9.25e-05, 0.000213, 0.000101, 8.95e-05, 8.85e-05, 0.0, 0.000207, 9.65e-05, 9.05e-05, 0.000243]
  CONV =[0.0010053685517187949031, 0.0010050283581860040246, 0.0010050109468929518394, 0.0010030602488507495633, 0.0010050109468794092278, 0.0030148929435695472194, 0.0010020093387333380717, 0.0010050109472946719814, 0.0010050221798409180395, 0.0030148929435695472194, 0.0030148929435695472194, 0.0010050362727498393625, 0.0030148929435695472194, 0.0010020009989874518292, 0.0030148929435695472194, 0.0010020025172624208554, 0.0010050221798561057422, 0.0030148929435695472194, 0.0010068847464266960405, 0.0010050164813971228616, 0.0010000337727699791769, 6.5561497176718002027e-08, 0.0030148929435695472194, 0.0010020009999315654303, 0.0010050176623350693234, 0.0030148929435695472194]
  #[0.0010053685517187949031, 0.0010050283581860040246, 0.0010050109468929518394, 0.0010030602488507495633, 0.0010050109468794092278, 0.0030148929435695472194, 0.0010020093387333380717, 0.0010050109472946719814, 0.0010050221798409180395, 0.0010020009969879950499, 0.0030148929435695472194, 0.0030148929435695472194, 0.0010050362727498393625, 0.0030148929435695472194, 0.0010020009989874518292, 0.0030148929435695472194, 0.0010020009971426968134, 0.0010020025172624208554, 0.0010050221798561057422, 0.0030148929435695472194, 0.0010068847464266960405, 0.0010050164813971228616, 0.0010000337727699791769, 6.5561497176718002027e-08, 0.0030148929435695472194, 0.0010020009999315654303, 0.0010050176623350693234, 0.0030148929435695472194]
  EMR =[0.0139450629923560, 0.0162080930165612, 0.00839879405437142, 0.138437021519246, 0.00663733900833972, 0.0389274708069242, 0.00231197003297432, 0.00568520020691726, 0.0135173451330998, 0.0430670974824760, 0.0487444703580032, 0.0981640264251833, 0.0374159686448752, 0.00179877954996446, 0.0304324433713488, 0.00160735368262164, 0.0141213676838256, 0.0345369667805539, 0.0177943976360550, 0.00925867834967103, 0.000258134467239860, 0.00102879870692213, 0.105410030290883, 0.000854470767647069, 0.0170310283779263, 0.0290942887226923]
  #[0.0139450629923560, 0.0162080930165612, 0.00839879405437142, 0.138437021519246, 0.00663733900833972, 0.0389274708069242, 0.00231197003297432, 0.00568520020691726, 0.0135173451330998, 0.000245024189468552, 0.0430670974824760, 0.0487444703580032, 0.0981640264251833, 0.0374159686448752, 0.00179877954996446, 0.0304324433713488, 0.000853877971175162, 0.00160735368262164, 0.0141213676838256, 0.0345369667805539, 0.0177943976360550, 0.00925867834967103, 0.000258134467239860, 0.00102879870692213, 0.105410030290883, 0.000854470767647069, 0.0170310283779263, 0.0290942887226923]
  print(len(SIM))
  print(len(CONV))
  print(len(EMR))
  SIM = SIM[:20]
  CONV = CONV[:20]
  EMR = EMR[:20]
  
  try:
      rects1 = ax.bar(ind-0.1, SIM, width, color='black', edgecolor='black')
      rects2 = ax.bar(ind+0.1, CONV, width, fill=False, edgecolor='black')
      rects3 = ax.bar(ind+0.3, EMR, width, edgecolor='black', hatch="/")
      ax.legend((rects1[0], rects2[0], rects3[0]), ('SIM', 'CON', 'EMR'))
  except ValueError:
      print("ValueError")
  figure = plt.gcf()
  figure.set_size_inches([14.5,6.5])
  
  #plt.legend(handles=[set1, set2, set3, set4, set5], fontsize=12, frameon=True, loc=3)
  
  pp.savefig()
  plt.clf()
  pp.close()
  
  
apis: matplotlib.pyplot.grid matplotlib.pyplot.gcf matplotlib.backends.backend_pdf.PdfPages matplotlib.pyplot.clf matplotlib.pyplot.title numpy.arange matplotlib.pyplot.subplot matplotlib.pyplot.ylabel matplotlib.use