Spaces:
Sleeping
Sleeping
felipekitamura
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def plot_reduced_data(reduced_data, labels, title):
|
|
22 |
plt.figure(figsize=(10, 8))
|
23 |
plt.scatter(reduced_data[:, 0], reduced_data[:, 1], alpha=0.6)
|
24 |
for i, label in enumerate(labels):
|
25 |
-
plt.annotate(label, (reduced_data[i, 0], reduced_data[i, 1]))
|
26 |
plt.title(title)
|
27 |
# Data for the arrow 1
|
28 |
start_point = (reduced_data[0, 0], reduced_data[0, 1]) # Starting point of the arrow
|
@@ -30,15 +30,15 @@ def plot_reduced_data(reduced_data, labels, title):
|
|
30 |
|
31 |
# Adding an arrow 1
|
32 |
plt.annotate('', xy=end_point, xytext=start_point,
|
33 |
-
arrowprops=dict(arrowstyle="->", color='green', lw=
|
34 |
|
35 |
# Data for the arrow 2
|
36 |
-
|
37 |
-
|
38 |
|
39 |
# Adding an arrow 2
|
40 |
plt.annotate('', xy=end_point, xytext=start_point,
|
41 |
-
arrowprops=dict(arrowstyle="->", color='green', lw=
|
42 |
|
43 |
plt.xlabel('Component 1')
|
44 |
plt.ylabel('Component 2')
|
|
|
22 |
plt.figure(figsize=(10, 8))
|
23 |
plt.scatter(reduced_data[:, 0], reduced_data[:, 1], alpha=0.6)
|
24 |
for i, label in enumerate(labels):
|
25 |
+
plt.annotate(label, (reduced_data[i, 0], reduced_data[i, 1]), size=10)
|
26 |
plt.title(title)
|
27 |
# Data for the arrow 1
|
28 |
start_point = (reduced_data[0, 0], reduced_data[0, 1]) # Starting point of the arrow
|
|
|
30 |
|
31 |
# Adding an arrow 1
|
32 |
plt.annotate('', xy=end_point, xytext=start_point,
|
33 |
+
arrowprops=dict(arrowstyle="->", color='green', lw=3))
|
34 |
|
35 |
# Data for the arrow 2
|
36 |
+
end_point = (reduced_data[2, 0] - (reduced_data[0, 0] - reduced_data[1, 0]), reduced_data[2, 1] - (reduced_data[0, 1] - reduced_data[1, 1])) # Starting point of the arrow
|
37 |
+
start_point = (reduced_data[2, 0], reduced_data[2, 1]) # Ending point of the arrow
|
38 |
|
39 |
# Adding an arrow 2
|
40 |
plt.annotate('', xy=end_point, xytext=start_point,
|
41 |
+
arrowprops=dict(arrowstyle="->", color='green', lw=3))
|
42 |
|
43 |
plt.xlabel('Component 1')
|
44 |
plt.ylabel('Component 2')
|