code: def _gen_institute_graph(start, end, force_overwrite=False):
      
      filename = graphs.get_institute_graph_filename(start, end)
      csv_filename = os.path.join(GRAPH_ROOT, filename + '.csv')
      png_filename = os.path.join(GRAPH_ROOT, filename + '.png')
  
      _check_directory_exists(csv_filename)
      _check_directory_exists(png_filename)
  
      if not settings.GRAPH_DEBUG or force_overwrite:
          if os.path.exists(csv_filename):
              if os.path.exists(png_filename):
                  return
  
      institute_list = Institute.active.all()
  
      plt.subplots(figsize=(4, 4))
  
      data = []
      labels = []
  
      total = 0
      with open(csv_filename, 'w') as csv_file:
          csv_writer = csv.writer(csv_file)
          for institute in institute_list.iterator():
              hours, jobs = usage.get_institute_usage(institute, start, end)
              total = total + int(hours)
              if hours > 0:
                  csv_writer.writerow([institute.name, hours, jobs])
                  data.append(hours)
                  labels.append(institute.name)
  
          mcu = usage.get_machine_category_usage(start, end)
          hours = int(mcu.available_time - total)
          csv_writer.writerow(["unused", hours])
          data.append(hours)
          labels.append('Unused')
  
      plt.pie(data, labels=labels, autopct='%1.1f%%', shadow=True)
      plt.tight_layout()
      plt.savefig(png_filename)
      plt.close()
docs: Pie chart comparing institutes usage.