Pouknouki

Disp

Nov 4th, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Fri Nov  4 15:55:02 2016
  4.  
  5. @author: Thomas
  6. """
  7.  
  8. import matplotlib.pyplot as plt
  9. plt.rcdefaults()
  10.  
  11. import numpy as np
  12. import matplotlib.pyplot as plt
  13. import matplotlib.path as mpath
  14. import matplotlib.lines as mlines
  15. import matplotlib.patches as mpatches
  16.  
  17. from matplotlib.collections import PatchCollection
  18.  
  19.  
  20. def ajouterOral(Oral, OrauxType, Color, patches):
  21.     import copy
  22.     temp = copy.deepcopy([o.Matiere for o in OrauxType])
  23.     temp.sort()
  24.     NumeroOral = temp.index(Oral.OralType_.Matiere)
  25.     rect = mpatches.Rectangle((Oral.Heure, NumeroOral), Oral.OralType_.Duree, 1, color = Color)
  26.     patches.append(rect)
  27.  
  28. def afficher(patches)
  29.     fig, ax = plt.subplots()
  30. #   colors = np.linspace(0, 1, len(patches))
  31. #   collection = PatchCollection(patches) #, cmap=plt.cm.hsv, alpha=0.3
  32. #   print([p.get_color() for p in patches])
  33.     #collection.set_array(np.array(colors))
  34.     for p in patches:
  35.         ax.add_patch(p)
  36. #   ax.add_collection(collection)  
  37.     maxMachines = max(rect.get_y() for rect in patches) + 1
  38.     maxJobs = max(rect.get_x() for rect in patches)
  39.     maxJobs = 30
  40.     plt.axis([0, maxJobs, 0, maxMachines])
  41.     plt.show()
Add Comment
Please, Sign In to add comment