-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphics.py
103 lines (86 loc) · 3.38 KB
/
graphics.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import matplotlib.pyplot as plt
from os import system
def grafico_througput(throughputlist, destino, time, arranjohoras):
print("Gerando gráfico de Throughput... \n")
x = arranjohoras
y = throughputlist
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='time (hours)', ylabel='throughput (bps)', title='Average Throughput')
ax.grid()
try:
fig.savefig(destino + "[" + str(time) + "]" + " - Throughput.png")
except FileNotFoundError:
system('mkdir '+destino)
fig.savefig(destino + "[" + str(time) + "]" + " - Throughput.png")
def grafico_packetloss(packetlosslist, destino, time, arranjohoras):
print("Gerando gráfico de Packet Loss... \n")
x = arranjohoras
y = packetlosslist
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='time (hours)', ylabel='loss(%)', title='Average Packet Loss')
ax.grid()
try:
fig.savefig(destino + "[" + str(time) + "]" + " - Packet_loss.png")
except FileNotFoundError:
system('mkdir '+destino)
fig.savefig(destino + "[" + str(time) + "]" + " - Packet_loss.png")
def grafico_delay(delaylist, destino, time, arranjohoras):
print("Gerando gráfico de Delay... \n")
x = arranjohoras
y = delaylist
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='time (hours)', ylabel='delay(ms)', title='Average Delay')
ax.grid()
try:
fig.savefig(destino + "[" + str(time) + "]" + " - Delay.png")
except FileNotFoundError:
system('mkdir '+destino)
fig.savefig(destino + "[" + str(time) + "]" + " - Delay.png")
def grafico_packet_vs_time(packetlist, destino, time, arranjohoras):
print("Gerando gráfico de Packets vs Time... \n")
x = arranjohoras
y = packetlist
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set(xlabel='time (hours)', ylabel='packets', title='Average Packets')
ax.grid()
try:
fig.savefig(destino + "[" + str(time) + "]" + " - Packet_vs_Time.png")
except FileNotFoundError:
system('mkdir '+destino)
fig.savefig(destino + "[" + str(time) + "]" + " - Packet_vs_Time.png")
# plt.savefig(subprocess.getoutput('pwd') + '/' + "margem_de_erro_throughput.png")
#
# #
# def grafico_margem_throughput(qtdhoras, throughput_central_list, throughput_maior_list, throughput_menor_list):
#
# x = arange(start=1, stop=qtdhoras + 1, step=1)
# y = throughput_central_list
#
# plt.errorbar(x, y, xerr=throughput_menor_list, yerr=throughput_maior_list, fmt='--o')
#
# # # First illustrate basic pyplot interface, using defaults where possible.
# # plt.figure()
# # plt.errorbar(x, y, xerr=0.2, yerr=0.4)
# # plt.title("Simplest errorbars, 0.2 in x, 0.4 in y")
# #
# # # Now switch to a more OO interface to exercise more features.
# # fig, axs = plt.subplots(nrows=2, ncols=2, sharex=True)
# # ax = axs[0, 0]
# # ax.errorbar(x, y, yerr=yerr, fmt='o')
# # ax.set_title('Vert. symmetric')
# #
# # # With 4 subplots, reduce the number of axis ticks to avoid crowding.
# # ax.locator_params(nbins=4)
# #
# # ax = axs[0, 1]
# # ax.errorbar(x, y, xerr=xerr, fmt='o')
# # ax.set_title('Hor. symmetric')
# #
# # ax = axs[1, 0]
# # # ax.errorbar(x, y, yerr=[yerr, 2 * yerr], xerr=[xerr, 2 * xerr], fmt='--o')
# # ax.errorbar(x, y, yerr=yerr, xerr=xerr, fmt='--o')
# # ax.set_title('H, V asymmetric')