Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Nov 4 15:55:02 2016
- @author: Thomas
- """
- import matplotlib.pyplot as plt
- plt.rcdefaults()
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.path as mpath
- import matplotlib.lines as mlines
- import matplotlib.patches as mpatches
- from matplotlib.collections import PatchCollection
- def ajouterOral(Oral, OrauxType, Color, patches):
- import copy
- temp = copy.deepcopy([o.Matiere for o in OrauxType])
- temp.sort()
- NumeroOral = temp.index(Oral.OralType_.Matiere)
- rect = mpatches.Rectangle((Oral.Heure, NumeroOral), Oral.OralType_.Duree, 1, color = Color)
- patches.append(rect)
- def afficher(patches):
- fig, ax = plt.subplots()
- # colors = np.linspace(0, 1, len(patches))
- # collection = PatchCollection(patches) #, cmap=plt.cm.hsv, alpha=0.3
- # print([p.get_color() for p in patches])
- #collection.set_array(np.array(colors))
- for p in patches:
- ax.add_patch(p)
- # ax.add_collection(collection)
- maxMachines = max(rect.get_y() for rect in patches) + 1
- maxJobs = max(rect.get_x() for rect in patches)
- maxJobs = 30
- plt.axis([0, maxJobs, 0, maxMachines])
- plt.show()
Add Comment
Please, Sign In to add comment