-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph.py
27 lines (20 loc) · 882 Bytes
/
graph.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
import matplotlib.pyplot as plt
import numpy as np
def plot_graph(sp, stats, statNames, xlabel, ylabel, verbose = False):
"Plot the statistics as line graphs over the swept range"
t = np.arange(sp.start_rate, sp.end_rate + sp.increment_rate, sp.increment_rate)
if verbose: print("StatNames ", statNames)
# Get the list of statistics stored in the collector
for statName in statNames:
# Extract each of the statistics
values = stats.extract(statName)
if verbose: print(statName, values)
# Plot the statistics as a line graph
plt.plot(t, values, label = statName)
# Done for
# Label the axes, legend and show the graph
plt.xlabel(xlabel)
plt.ylabel(ylabel)
plt.legend()
plt.show()
# End of plot_graph