-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotador.py
42 lines (29 loc) · 845 Bytes
/
Plotador.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
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def plot_simples(x, y, label):
# Data for plotting
xx = np.array(x)
yy = np.array(y)
fig, ax = plt.subplots()
ax.plot(xx, yy)
ax.set(xlabel='Tamanho N', ylabel='Tempo de execução',
title=label)
ax.grid()
plt.show()
def plot_duplo(inicio, fim, y1, label1, y2, label2):
yy1 = np.array(y1)
yy2 = np.array(y2)
max_time = 0
max_time_y1 = max(y1)
max_time_y2 = max(y2)
max_time = max_time_y1 if max_time_y1 > max_time_y2 else max_time_y2
x = range(inicio, fim+1)
y = range(0, int(float(max_time))+1)
fig, ax = plt.subplots()
ax.plot(x, yy1, label=label1)
ax.plot(x, yy2, label=label2)
ax.set(xlabel='Tamanho N', ylabel='Tempo de execução',
title="{} x {}".format(label1, label2))
plt.legend()
plt.show()