-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlotGraphs.py
executable file
·58 lines (42 loc) · 1.87 KB
/
PlotGraphs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import matplotlib.pyplot as plot
# Reference: https://www.geeksforgeeks.org/graph-plotting-in-python-set-1/
class PlotGraphs(object):
# def __init__(self, waiting_time_list, completion_time_list):
# self.waiting_time_list = waiting_time_list
# self.completion_time_list = completion_time_list
def compare_waiting_times(self,waiting_time_list):
# x-coordinates of left sides of bars
left = [1, 2, 3]
# heights of bars
height = waiting_time_list
# labels for bars
tick_label = ['Priority', 'Fcfs', 'Linux']
# plotting a bar chart
plot.bar(left, height, tick_label=tick_label,
width=0.6, color=['blue'])
# naming the x-axis
plot.xlabel('x - axis')
# naming the y-axis
plot.ylabel('y - axis')
# plot title
plot.title('Waiting Time Comparison')
# function to show the plot
plot.show()
def compare_completion_times(self, completion_time_list):
# x-coordinates of left sides of bars
left = [1, 2, 3]
# heights of bars
height = completion_time_list
# labels for bars
tick_label = ['Priority', 'Fcfs', 'Linux']
# plotting a bar chart
plot.bar(left, height, tick_label=tick_label,
width=0.6, color=['blue'])
# naming the x-axis
plot.xlabel('x - axis')
# naming the y-axis
plot.ylabel('y - axis')
# plot title
plot.title('Completion Time Comparison')
# function to show the plot
plot.show()