-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_html.py
60 lines (48 loc) · 1.84 KB
/
plot_html.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
"""
===============================
Legend using pre-defined labels
===============================
Defining legend labels with plots.
"""
import numpy as np
import matplotlib.pyplot as plt
def plot_with_x(x, x_label, total, title, legend_pos='upper right', color="b"):
# Make some fake data.
# Create plots with pre-defined labels.
fig, ax = plt.subplots()
ax.plot(x, total, color, marker='o')
plt.set_cmap('Paired')
legend = ax.legend(loc=legend_pos)
plt.grid(b=True, color='#666666', linestyle='dotted')
ax.set_ylim(ymin=0)
ax.set_xlim(xmin=0)
ax.set_ylabel('Temps d\'éxecution (s)')
ax.set_xlabel(x_label)
ax.set_title(title)
plt.show()
def plot_for_nb_triplets(x, x_label, y):
fig, ax = plt.subplots()
ax.plot(x, y, 'r', marker='o')
plt.set_cmap('Paired')
legend = ax.legend(loc='upper left')
plt.grid(b=True, color='#666666', linestyle='dotted')
ax.set_ylim(ymin=0)
ax.set_xlim(xmin=0)
ax.set_ylabel('Nombre de triplets')
ax.set_xlabel(x_label)
ax.set_title(
'Nombre de triplets en fonction du nombre de phrases')
plt.show()
taille = [1.4, 24, 162, 3100]
nb_tables = [2, 8, 13, 540]
nb_paragraphs = [3, 7, 10, 286]
total = [2.5, 5.64, 16.7, 421.9]
plot_with_x(taille, 'Taille du fichier (kB)', total,
'le temps d\'exécution en fonction de la taille du fichier', legend_pos="upper left", color="g")
plot_with_x(nb_tables, 'Nombre des tableaux', total,
'le temps d\'exécution en fonction du nombre des tableaux', legend_pos="upper left", color="b")
plot_with_x(nb_paragraphs, 'Nombre des paragraphes', total,
'le temps d\'exécution en fonction du nombre des paragraphes', legend_pos="upper left", color='c')
nb_triplets = [6, 107, 661, 1542]
plot_for_nb_triplets(
taille, 'Nombre de phrases du fichier', nb_triplets)