Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,13 +24,22 @@ def plot_reduced_data(reduced_data, labels, title):
|
|
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
|
28 |
start_point = (reduced_data[0, 0], reduced_data[0, 1]) # Starting point of the arrow
|
29 |
end_point = (reduced_data[1, 0], reduced_data[1, 1]) # Ending point of the arrow
|
30 |
|
31 |
-
# Adding an arrow
|
32 |
plt.annotate('', xy=end_point, xytext=start_point,
|
33 |
-
arrowprops=dict(arrowstyle="->", color='
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
plt.xlabel('Component 1')
|
35 |
plt.ylabel('Component 2')
|
36 |
plt.grid(True)
|
|
|
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
|
29 |
end_point = (reduced_data[1, 0], reduced_data[1, 1]) # Ending 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=2))
|
34 |
+
|
35 |
+
# Data for the arrow 2
|
36 |
+
start_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 |
+
end_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=2))
|
42 |
+
|
43 |
plt.xlabel('Component 1')
|
44 |
plt.ylabel('Component 2')
|
45 |
plt.grid(True)
|